Skip to content
Permalink
Browse files
Patched in code from Oleg Gusev to emit poisiton on right mouse click
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6955 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed May 22, 2007
1 parent f25472d commit 0df5d5301eb3513a795543a6417009c9cbd9a419
@@ -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


@@ -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);
@@ -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));
}
@@ -30,6 +30,8 @@ public slots:
void on_buttonOk_clicked();
void on_buttonCancel_clicked();

void setXY(QgsPoint &);

private:

QgsPoint mPixelCoords;
@@ -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();
}

@@ -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();

0 comments on commit 0df5d53

Please sign in to comment.