Skip to content

Commit 0f590db

Browse files
committed
set objectName on QMenu/QAction in C++ core plugins, fixes partially #9134
1 parent eeae09c commit 0f590db

File tree

24 files changed

+77
-19
lines changed

24 files changed

+77
-19
lines changed

src/app/qgisapp.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7594,7 +7594,7 @@ QMenu* QgisApp::getPluginMenu( QString menuName )
75947594
}
75957595
// It doesn't exist, so create
75967596
QMenu *menu = new QMenu( menuName, this );
7597-
menu->setObjectName( menuName.normalized( QString::NormalizationForm_KD ).remove( QRegExp( "[^a-zA-Z]" ) ) );
7597+
menu->setObjectName( normalizedMenuName( menuName ) );
75987598
// Where to put it? - we worked that out above...
75997599
mPluginMenu->insertMenu( before, menu );
76007600

@@ -7656,6 +7656,7 @@ QMenu* QgisApp::getDatabaseMenu( QString menuName )
76567656
}
76577657
// It doesn't exist, so create
76587658
QMenu *menu = new QMenu( menuName, this );
7659+
menu->setObjectName( normalizedMenuName( menuName ) );
76597660
if ( before )
76607661
mDatabaseMenu->insertMenu( before, menu );
76617662
else
@@ -7705,6 +7706,7 @@ QMenu* QgisApp::getRasterMenu( QString menuName )
77057706

77067707
// It doesn't exist, so create
77077708
QMenu *menu = new QMenu( menuName, this );
7709+
menu->setObjectName( normalizedMenuName( menuName ) );
77087710
if ( before )
77097711
mRasterMenu->insertMenu( before, menu );
77107712
else
@@ -7744,6 +7746,7 @@ QMenu* QgisApp::getVectorMenu( QString menuName )
77447746
}
77457747
// It doesn't exist, so create
77467748
QMenu *menu = new QMenu( menuName, this );
7749+
menu->setObjectName( normalizedMenuName( menuName ) );
77477750
if ( before )
77487751
mVectorMenu->insertMenu( before, menu );
77497752
else
@@ -7783,6 +7786,7 @@ QMenu* QgisApp::getWebMenu( QString menuName )
77837786
}
77847787
// It doesn't exist, so create
77857788
QMenu *menu = new QMenu( menuName, this );
7789+
menu->setObjectName( normalizedMenuName( menuName ) );
77867790
if ( before )
77877791
mWebMenu->insertMenu( before, menu );
77887792
else

src/app/qgisapp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,9 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
448448
QList<QgsDecorationItem*> decorationItems() { return mDecorationItems; }
449449
void addDecorationItem( QgsDecorationItem* item ) { mDecorationItems.append( item ); }
450450

451+
/** @note added in 2.1 */
452+
static QString normalizedMenuName( const QString & name ) { return name.normalized( QString::NormalizationForm_KD ).remove( QRegExp( "[^a-zA-Z]" ) ); }
453+
451454
#ifdef Q_OS_WIN
452455
//! ugly hack
453456
void skipNextContextMenuEvent();

src/app/qgscustomization.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ QgsCustomizationDialog::QgsCustomizationDialog( QWidget *parent, QSettings* sett
4747
mSettings = settings;
4848
setupUi( this );
4949

50+
QSettings appSettings;
51+
restoreGeometry( appSettings.value( "/Windows/Customization/geometry" ).toByteArray() );
52+
5053
init();
5154
QStringList myHeaders;
5255
myHeaders << tr( "Object name" ) << tr( "Label" ) << tr( "Description" );
@@ -63,6 +66,8 @@ QgsCustomizationDialog::QgsCustomizationDialog( QWidget *parent, QSettings* sett
6366

6467
QgsCustomizationDialog::~QgsCustomizationDialog()
6568
{
69+
QSettings settings;
70+
settings.setValue( "/Windows/Customization/geometry", saveGeometry() );
6671
}
6772

6873
QTreeWidgetItem * QgsCustomizationDialog::item( QString thePath, QTreeWidgetItem *theItem )

src/plugins/compass/qgscompassplugin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ void QgsCompassPlugin::initGui()
100100

101101
// Create the action for tool
102102
mActionRunCompass = new QAction( QIcon(), tr( "Show compass" ), this );
103+
mActionRunCompass->setObjectName( "mActionRunCompass" );
103104
connect( mActionRunCompass, SIGNAL( triggered() ), this, SLOT( run() ) );
104105

105106
mActionAboutCompass = new QAction( QIcon(), tr( "&About" ), this );
107+
mActionAboutCompass->setObjectName( "mActionAboutCompass" );
106108
connect( mActionAboutCompass, SIGNAL( triggered() ), this, SLOT( about() ) );
107109

108110
setCurrentTheme( "" );

src/plugins/coordinate_capture/coordinatecapture.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ void CoordinateCapture::initGui()
100100

101101
// Create the action for tool
102102
mQActionPointer = new QAction( QIcon(), tr( "Coordinate Capture" ), this );
103+
mQActionPointer->setObjectName( "mQActionPointer" );
103104
mQActionPointer->setCheckable( true );
104105
mQActionPointer->setChecked( mpDockWidget->isVisible() );
105106
// Set the what's this text

src/plugins/dxf2shp_converter/dxf2shpconverter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ void dxf2shpConverter::initGui()
7171
// Create the action for tool
7272
delete mQActionPointer;
7373
mQActionPointer = new QAction( QIcon(), "Dxf2Shp Converter", this );
74+
mQActionPointer->setObjectName( "mQActionPointer" );
7475

7576
// Set the icon
7677
setCurrentTheme( "" );

src/plugins/evis/evis.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ void eVis::initGui()
110110

111111
// Create the action for tool
112112
mDatabaseConnectionActionPointer = new QAction( QIcon( ":/evis/eVisDatabaseConnection.png" ), tr( "eVis Database Connection" ), this );
113+
mDatabaseConnectionActionPointer->setObjectName( "mDatabaseConnectionActionPointer" );
113114
mEventIdToolActionPointer = new QAction( QIcon( ":/evis/eVisEventIdTool.png" ), tr( "eVis Event Id Tool" ), this );
115+
mEventIdToolActionPointer->setObjectName( "mEventIdToolActionPointer" );
114116
mEventBrowserActionPointer = new QAction( QIcon( ":/evis/eVisEventBrowser.png" ), tr( "eVis Event Browser" ), this );
117+
mEventBrowserActionPointer->setObjectName( "mEventBrowserActionPointer" );
115118

116119
// Set the what's this text
117120
mDatabaseConnectionActionPointer->setWhatsThis( tr( "Create layer from a database query" ) );

src/plugins/georeferencer/qgsgeorefplugin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ void QgsGeorefPlugin::initGui()
9999

100100
// Create the action for tool
101101
mActionRunGeoref = new QAction( QIcon(), tr( "&Georeferencer" ), this );
102+
mActionRunGeoref->setObjectName( "mActionRunGeoref" );
102103

103104
// Connect the action to the run
104105
connect( mActionRunGeoref, SIGNAL( triggered() ), this, SLOT( run() ) );

src/plugins/georeferencer/qgsgeorefplugingui.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,10 +968,12 @@ void QgsGeorefPluginGui::createMenus()
968968
QDialogButtonBox::ButtonLayout( style()->styleHint( QStyle::SH_DialogButtonLayout, 0, this ) );
969969

970970
mPanelMenu = new QMenu( tr( "Panels" ) );
971+
mPanelMenu->setObjectName( "mPanelMenu" );
971972
mPanelMenu->addAction( dockWidgetGCPpoints->toggleViewAction() );
972973
// mPanelMenu->addAction(dockWidgetLogView->toggleViewAction());
973974

974975
mToolbarMenu = new QMenu( tr( "Toolbars" ) );
976+
mToolbarMenu->setObjectName( "mToolbarMenu" );
975977
mToolbarMenu->addAction( toolBarFile->toggleViewAction() );
976978
mToolbarMenu->addAction( toolBarEdit->toggleViewAction() );
977979
mToolbarMenu->addAction( toolBarView->toggleViewAction() );

src/plugins/globe/globe_plugin.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,11 @@ void GlobePlugin::initGui()
220220

221221
// Create the action for tool
222222
mQActionPointer = new QAction( QIcon( ":/globe/globe.png" ), tr( "Launch Globe" ), this );
223+
mQActionPointer->setObjectName( "mQActionPointer" );
223224
mQActionSettingsPointer = new QAction( QIcon( ":/globe/globe.png" ), tr( "Globe Settings" ), this );
225+
mQActionSettingsPointer->setObjectName( "mQActionSettingsPointer" );
224226
mQActionUnload = new QAction( tr( "Unload Globe" ), this );
227+
mQActionUnload->setObjectName( "mQActionUnload" );
225228

226229
// Set the what's this text
227230
mQActionPointer->setWhatsThis( tr( "Overlay data on a 3D globe" ) );

0 commit comments

Comments
 (0)