@@ -78,10 +78,8 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
78
78
79
79
// open form button
80
80
mOpenFormButton = new QToolButton ( this );
81
- mOpenFormAction = new QAction ( QgsApplication::getThemeIcon ( " /mActionPropertyItem.png" ), tr ( " Open related feature form" ), this );
82
- mOpenFormButton ->addAction ( mOpenFormAction );
83
- mOpenFormButton ->setDefaultAction ( mOpenFormAction );
84
- connect ( mOpenFormButton , SIGNAL ( triggered ( QAction* ) ), this , SLOT ( openForm () ) );
81
+ mOpenFormButton ->setIcon ( QgsApplication::getThemeIcon ( " /mActionPropertyItem.png" ) );
82
+ mOpenFormButton ->setText ( tr ( " Open related feature form" ) );
85
83
editLayout->addWidget ( mOpenFormButton );
86
84
87
85
// highlight button
@@ -94,24 +92,19 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
94
92
mHighlightFeatureButton ->addAction ( mScaleHighlightFeatureAction );
95
93
mHighlightFeatureButton ->addAction ( mPanHighlightFeatureAction );
96
94
mHighlightFeatureButton ->setDefaultAction ( mHighlightFeatureAction );
97
- connect ( mHighlightFeatureButton , SIGNAL ( triggered ( QAction* ) ), this , SLOT ( highlightActionTriggered ( QAction* ) ) );
98
95
editLayout->addWidget ( mHighlightFeatureButton );
99
96
100
97
// map identification button
101
98
mMapIdentificationButton = new QToolButton ( this );
102
- mMapIdentificationAction = new QAction ( QgsApplication::getThemeIcon ( " /mActionMapIdentification.svg" ), tr ( " Select on map" ), this );
103
- mMapIdentificationAction ->setCheckable ( true );
104
- mMapIdentificationButton ->addAction ( mMapIdentificationAction );
105
- mMapIdentificationButton ->setDefaultAction ( mMapIdentificationAction );
106
- connect ( mMapIdentificationButton , SIGNAL ( triggered ( QAction* ) ), this , SLOT ( mapIdentification () ) );
99
+ mMapIdentificationButton ->setIcon ( QgsApplication::getThemeIcon ( " /mActionMapIdentification.svg" ) );
100
+ mMapIdentificationButton ->setText ( tr ( " Select on map" ) );
101
+ mMapIdentificationButton ->setCheckable ( true );
107
102
editLayout->addWidget ( mMapIdentificationButton );
108
103
109
104
// remove foreign key button
110
105
mRemoveFKButton = new QToolButton ( this );
111
- mRemoveFKAction = new QAction ( QgsApplication::getThemeIcon ( " /mActionRemove.svg" ), tr ( " No selection" ), this );
112
- mRemoveFKButton ->addAction ( mRemoveFKAction );
113
- mRemoveFKButton ->setDefaultAction ( mRemoveFKAction );
114
- connect ( mRemoveFKButton , SIGNAL ( triggered ( QAction* ) ), this , SLOT ( deleteForeignKey () ) );
106
+ mRemoveFKButton ->setIcon ( QgsApplication::getThemeIcon ( " /mActionRemove.svg" ) );
107
+ mRemoveFKButton ->setText ( tr ( " No selection" ) );
115
108
editLayout->addWidget ( mRemoveFKButton );
116
109
117
110
// spacer
@@ -142,6 +135,12 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
142
135
mHighlightFeatureButton ->hide ();
143
136
mAttributeEditorFrame ->hide ();
144
137
mInvalidLabel ->hide ();
138
+
139
+ // connect buttons
140
+ connect ( mOpenFormButton , SIGNAL ( clicked () ), this , SLOT ( openForm () ) );
141
+ connect ( mHighlightFeatureButton , SIGNAL ( triggered ( QAction* ) ), this , SLOT ( highlightActionTriggered ( QAction* ) ) );
142
+ connect ( mMapIdentificationButton , SIGNAL ( clicked () ), this , SLOT ( mapIdentification () ) );
143
+ connect ( mRemoveFKButton , SIGNAL ( clicked () ), this , SLOT ( deleteForeignKey () ) );
145
144
}
146
145
147
146
QgsRelationReferenceWidget::~QgsRelationReferenceWidget ()
@@ -331,7 +330,7 @@ void QgsRelationReferenceWidget::setEditorContext( QgsAttributeEditorContext con
331
330
if ( mMapTool )
332
331
delete mMapTool ;
333
332
mMapTool = new QgsMapToolIdentifyFeature ( mCanvas );
334
- mMapTool ->setAction ( mMapIdentificationAction );
333
+ mMapTool ->setAction ( mMapIdentificationButton -> defaultAction () );
335
334
}
336
335
337
336
void QgsRelationReferenceWidget::setEmbedForm ( bool display )
0 commit comments