Skip to content
Permalink
Browse files

more public methods, fix delete map tool

  • Loading branch information
3nids committed Sep 18, 2014
1 parent c665805 commit 11be64db850fe20623164fe55a76441f5dbc764b
@@ -45,12 +45,21 @@ class QgsRelationReferenceWidget : QWidget
bool openFormButtonVisible();
void setOpenFormButtonVisible( bool openFormButtonVisible );

//! return the related feature (from the referenced layer)
//! if no feature is related, it returns an invalid feature
QgsFeature referencedFeature();

public slots:
//! open the form of the related feature in a new dialog
void openForm();
//! activate the map tool to select the related feature on the map

//! activate the map tool to select a new related feature on the map
void mapIdentification();

//! unset the currently related feature
void deleteForeignKey();


protected:
virtual void showEvent( QShowEvent* e );

@@ -11,6 +11,8 @@ class QgsMapToolIdentifyFeature : QgsMapToolIdentify
* @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 );

~QgsMapToolIdentifyFeature();

//! change the layer used by the map tool to identify
void setLayer( QgsVectorLayer* vl );
@@ -138,7 +138,8 @@ QgsRelationReferenceWidget::~QgsRelationReferenceWidget()
{
deleteHighlight();
unsetMapTool();
delete mMapTool;
if ( mMapTool )
delete mMapTool;
}

void QgsRelationReferenceWidget::setRelation( QgsRelation relation, bool allowNullValue )
@@ -277,7 +278,7 @@ void QgsRelationReferenceWidget::deleteForeignKey()
emit foreignKeyChanged( QVariant( QVariant::Int ) );
}

QgsFeature QgsRelationReferenceWidget::relatedFeature()
QgsFeature QgsRelationReferenceWidget::referencedFeature()
{
QgsFeature f;
if ( mReferencedLayer )
@@ -422,7 +423,7 @@ void QgsRelationReferenceWidget::highlightActionTriggered( QAction* action )

void QgsRelationReferenceWidget::openForm()
{
QgsFeature feat = relatedFeature();
QgsFeature feat = referencedFeature();

if ( !feat.isValid() )
return;
@@ -439,7 +440,7 @@ void QgsRelationReferenceWidget::highlightFeature( QgsFeature f, CanvasExtent ca

if ( !f.isValid() )
{
f = relatedFeature();
f = referencedFeature();
if ( !f.isValid() )
return;
}
@@ -75,12 +75,20 @@ class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
bool openFormButtonVisible() {return mOpenFormButtonVisible;}
void setOpenFormButtonVisible( bool openFormButtonVisible );

//! return the related feature (from the referenced layer)
//! if no feature is related, it returns an invalid feature
QgsFeature referencedFeature();

public slots:
//! open the form of the related feature in a new dialog
void openForm();
//! activate the map tool to select the related feature on the map

//! activate the map tool to select a new related feature on the map
void mapIdentification();

//! unset the currently related feature
void deleteForeignKey();

protected:
virtual void showEvent( QShowEvent* e );

@@ -93,13 +101,11 @@ class GUI_EXPORT QgsRelationReferenceWidget : public QWidget
void highlightActionTriggered( QAction* action );
void deleteHighlight();
void comboReferenceChanged( int index );
void deleteForeignKey();
void featureIdentified( const QgsFeature& feature );
void unsetMapTool();
void mapToolDeactivated();

private:
QgsFeature relatedFeature();
void highlightFeature( QgsFeature f = QgsFeature(), CanvasExtent canvasExtent = Fixed );
void updateAttributeEditorFrame( const QgsFeature feature );

@@ -29,6 +29,10 @@ QgsMapToolIdentifyFeature::QgsMapToolIdentifyFeature( QgsMapCanvas* canvas, QgsV
mCursor = QCursor( cursorPixmap, 1, 1 );
}

QgsMapToolIdentifyFeature::~QgsMapToolIdentifyFeature()
{
}

void QgsMapToolIdentifyFeature::canvasReleaseEvent( QMouseEvent* e )
{

@@ -35,8 +35,10 @@ class GUI_EXPORT QgsMapToolIdentifyFeature : public QgsMapToolIdentify
*/
QgsMapToolIdentifyFeature( QgsMapCanvas* canvas, QgsVectorLayer* vl = 0 );

~QgsMapToolIdentifyFeature();

//! change the layer used by the map tool to identify
void setLayer( QgsVectorLayer* vl ){ mLayer = vl; }
void setLayer( QgsVectorLayer* vl ) { mLayer = vl; }

virtual void canvasReleaseEvent( QMouseEvent* e );

0 comments on commit 11be64d

Please sign in to comment.
You can’t perform that action at this time.