Skip to content

Commit

Permalink
Patched in code from Oleg Gusev to emit poisiton on right mouse click
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@6955 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed May 22, 2007
1 parent 63d9a29 commit 8643bfb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -636,6 +636,13 @@ void QgsMapCanvas::mousePressEvent(QMouseEvent * e)
mCanvasProperties->mouseButtonDown = true;
mCanvasProperties->rubberStartPoint = e->pos();

if (e->button() == Qt::RightButton )
{
QPoint xy = e->pos();
QgsPoint coord = getCoordinateTransform()->toMapCoordinates(xy);
emit sendXY(coord);
}

} // mousePressEvent


Expand Down
2 changes: 2 additions & 0 deletions src/gui/qgsmapcanvas.h
Expand Up @@ -274,6 +274,8 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
void setProgress(int,int);
/** emits current mouse position */
void xyCoordinates(QgsPoint & p);
/** emits current mouse position on right mouse click */
void sendXY(QgsPoint & p);

//! Emitted when the scale of the map changes
void scaleChanged(double);
Expand Down
6 changes: 6 additions & 0 deletions src/plugins/georeferencer/mapcoordsdialog.cpp
Expand Up @@ -32,3 +32,9 @@ void MapCoordsDialog::on_buttonCancel_clicked()
{
reject();
}

void MapCoordsDialog::setXY(QgsPoint & xy)
{
leXCoord->insert(QString::number(xy.x(),'f',7));
leYCoord->insert(QString::number(xy.y(),'f',7));
}
2 changes: 2 additions & 0 deletions src/plugins/georeferencer/mapcoordsdialog.h
Expand Up @@ -30,6 +30,8 @@ public slots:
void on_buttonOk_clicked();
void on_buttonCancel_clicked();

void setXY(QgsPoint &);

private:

QgsPoint mPixelCoords;
Expand Down
1 change: 1 addition & 0 deletions src/plugins/georeferencer/qgspointdialog.cpp
Expand Up @@ -443,6 +443,7 @@ void QgsPointDialog::showCoordDialog(QgsPoint& pixelCoords)
MapCoordsDialog* mcd = new MapCoordsDialog(pixelCoords, this);
connect(mcd, SIGNAL(pointAdded(const QgsPoint&, const QgsPoint&)),
this, SLOT(addPoint(const QgsPoint&, const QgsPoint&)));
connect(mIface->getMapCanvas(),SIGNAL(sendXY(QgsPoint&)),mcd,SLOT(setXY(QgsPoint&)));
mcd->show();
}

Expand Down
3 changes: 2 additions & 1 deletion src/plugins/grass/qgsgrassattributes.cpp
Expand Up @@ -241,7 +241,8 @@ void QgsGrassAttributes::addAttribute ( int tab, const QString &name, const QStr

// I have no rational explanation why fromLocal8Bit is necessary, value should be in unicode
// because QgsGrassProvider::attributes is using mEncoding->toUnicode()
tb->setText ( row, 1, QString::fromLocal8Bit(value) );
// tb->setText ( row, 1, QString::fromLocal8Bit(value) );
tb->setText ( row, 1, value );
tb->setText ( row, 2, type );

resetButtons();
Expand Down

0 comments on commit 8643bfb

Please sign in to comment.