mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
[QgsMapToolIdentifyFeature] allow initializing without any layer
This commit is contained in:
parent
5483ee8064
commit
fb30b84cfb
@ -5,7 +5,15 @@ class QgsMapToolIdentifyFeature : QgsMapToolIdentify
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QgsMapToolIdentifyFeature( QgsVectorLayer* vl, QgsMapCanvas* canvas );
|
/**
|
||||||
|
* @brief QgsMapToolIdentifyFeature is a map tool to identify a feature on a chosen layer
|
||||||
|
* @param canvas the map canvas
|
||||||
|
* @param vl the vector layer. The map tool can be initialized without any layer and can be set afterward.
|
||||||
|
*/
|
||||||
|
QgsMapToolIdentifyFeature( QgsMapCanvas* canvas, QgsVectorLayer* vl = 0 );
|
||||||
|
|
||||||
|
//! change the layer used by the map tool to identify
|
||||||
|
void setLayer( QgsVectorLayer* vl );
|
||||||
|
|
||||||
void canvasReleaseEvent( QMouseEvent* e );
|
void canvasReleaseEvent( QMouseEvent* e );
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ void QgsRelationReferenceWidget::mapIdentification()
|
|||||||
if ( !mCanvas )
|
if ( !mCanvas )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mMapTool = new QgsMapToolIdentifyFeature( mReferencedLayer, mCanvas );
|
mMapTool = new QgsMapToolIdentifyFeature( mCanvas, mReferencedLayer );
|
||||||
mCanvas->setMapTool( mMapTool );
|
mCanvas->setMapTool( mMapTool );
|
||||||
mWindowWidget = window();
|
mWindowWidget = window();
|
||||||
mWindowWidget->hide();
|
mWindowWidget->hide();
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
#include "qgsmaptoolidentifyfeature.h"
|
#include "qgsmaptoolidentifyfeature.h"
|
||||||
#include "qgsmapcanvas.h"
|
#include "qgsmapcanvas.h"
|
||||||
|
|
||||||
QgsMapToolIdentifyFeature::QgsMapToolIdentifyFeature( QgsVectorLayer* vl, QgsMapCanvas* canvas )
|
QgsMapToolIdentifyFeature::QgsMapToolIdentifyFeature( QgsMapCanvas* canvas, QgsVectorLayer* vl )
|
||||||
: QgsMapToolIdentify( canvas )
|
: QgsMapToolIdentify( canvas )
|
||||||
, mLayer( vl )
|
|
||||||
, mCanvas( canvas )
|
, mCanvas( canvas )
|
||||||
|
, mLayer( vl )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "qgsmaptoolidentify.h"
|
#include "qgsmaptoolidentify.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The QgsMapToolIdentifyFeature class is a map tool to be used to identify a feature on a chosen layer.
|
* @brief The QgsMapToolIdentifyFeature class is a map tool to identify a feature on a chosen layer.
|
||||||
* Once the map tool is enable, user can click on the map canvas to identify a feature.
|
* Once the map tool is enable, user can click on the map canvas to identify a feature.
|
||||||
* A signal will then be emitted.
|
* A signal will then be emitted.
|
||||||
*/
|
*/
|
||||||
@ -28,7 +28,15 @@ class GUI_EXPORT QgsMapToolIdentifyFeature : public QgsMapToolIdentify
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QgsMapToolIdentifyFeature( QgsVectorLayer* vl, QgsMapCanvas* canvas );
|
/**
|
||||||
|
* @brief QgsMapToolIdentifyFeature is a map tool to identify a feature on a chosen layer
|
||||||
|
* @param canvas the map canvas
|
||||||
|
* @param vl the vector layer. The map tool can be initialized without any layer and can be set afterward.
|
||||||
|
*/
|
||||||
|
QgsMapToolIdentifyFeature( QgsMapCanvas* canvas, QgsVectorLayer* vl = 0 );
|
||||||
|
|
||||||
|
//! change the layer used by the map tool to identify
|
||||||
|
void setLayer( QgsVectorLayer* vl ){ mLayer = vl; }
|
||||||
|
|
||||||
virtual void canvasReleaseEvent( QMouseEvent* e );
|
virtual void canvasReleaseEvent( QMouseEvent* e );
|
||||||
|
|
||||||
@ -40,8 +48,8 @@ class GUI_EXPORT QgsMapToolIdentifyFeature : public QgsMapToolIdentify
|
|||||||
virtual void keyPressEvent( QKeyEvent* e );
|
virtual void keyPressEvent( QKeyEvent* e );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QgsVectorLayer* mLayer;
|
|
||||||
QgsMapCanvas* mCanvas;
|
QgsMapCanvas* mCanvas;
|
||||||
|
QgsVectorLayer* mLayer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGSMAPTOOLIDENTIFYFEATURE_H
|
#endif // QGSMAPTOOLIDENTIFYFEATURE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user