Skip to content

Commit d0a7eca

Browse files
author
timlinux
committedMar 21, 2009
Enable plugins to dynamically change their theme if it is changed in app props. Its up to each plugin to individually support this
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10393 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

6 files changed

+20
-0
lines changed

6 files changed

+20
-0
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,7 @@ void QgisApp::setTheme( QString theThemeName )
14851485
{
14861486
mComposer->setupTheme();
14871487
}
1488+
emit currentThemeChanged( theThemeName );
14881489
}
14891490

14901491
void QgisApp::setupConnections()

‎src/app/qgisapp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,12 @@ class QgisApp : public QMainWindow
599599
//! emitted when a new bookmark is added
600600
void bookmarkAdded();
601601

602+
/** Signal emitted when the current theme is changed so plugins
603+
* can change there tool button icons.
604+
* @note This was added in QGIS 1.1
605+
*/
606+
void currentThemeChanged ( QString );
607+
602608
private:
603609
/** This method will open a dialog so the user can select the sublayers
604610
* to load

‎src/app/qgisappinterface.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ QgisAppInterface::QgisAppInterface( QgisApp * _qgis )
3636
// connect signals
3737
connect( qgis->legend(), SIGNAL( currentLayerChanged( QgsMapLayer * ) ),
3838
this, SIGNAL( currentLayerChanged( QgsMapLayer * ) ) );
39+
connect( qgis, SIGNAL( currentThemeChanged( QString ) ),
40+
this, SIGNAL( currentThemeChanged( QString ) ) );
3941

4042
}
4143

‎src/app/qgisappinterface.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ class QgisAppInterface : public QgisInterface
234234
virtual QAction *actionHelpSeparator2();
235235
virtual QAction *actionAbout();
236236

237+
signals:
238+
void currentThemeChanged( QString );
239+
237240
private:
238241

239242
/// QgisInterface aren't copied

‎src/plugins/coordinate_capture/coordinatecapture.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void CoordinateCapture::initGui()
8383
mCrs.createFromSrsId( GEOCRS_ID ); // initialize the CRS object
8484

8585
connect( mQGisIface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setSourceCrs() ) );
86+
connect( mQGisIface, SIGNAL( currentThemeChanged ( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
8687

8788
setSourceCrs(); //set up the source CRS
8889
mTransform.setDestCRS( mCrs ); // set the CRS in the transform
@@ -251,6 +252,11 @@ void CoordinateCapture::unload()
251252
delete mQActionPointer;
252253
}
253254

255+
void CoordinateCapture::setCurrentTheme ( QString theThemeName )
256+
{
257+
qDebug (" Current theme changed \n\n\n\n\n" );
258+
mQActionPointer->setIcon( QIcon());
259+
}
254260

255261
//////////////////////////////////////////////////////////////////////////
256262
//

‎src/plugins/coordinate_capture/coordinatecapture.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ class CoordinateCapture: public QObject, public QgisPlugin
103103
void copy();
104104
//! called when the project's CRS is changed
105105
void setSourceCrs();
106+
//! update the plugins theme when the app tells us its theme is changed
107+
void setCurrentTheme ( QString theThemeName );
106108

107109
private:
108110
//! Container for the coordinate info

0 commit comments

Comments
 (0)
Please sign in to comment.