Skip to content

Commit d386c66

Browse files
committed
Moved scale bar plugin to app
1 parent 5ca2c32 commit d386c66

16 files changed

Lines changed: 178 additions & 591 deletions

images/images.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@
352352
<file>themes/default/unlocked.png</file>
353353
<file>themes/default/plugins/copyright_label.png</file>
354354
<file>themes/default/plugins/north_arrow.png</file>
355+
<file>themes/default/plugins/scale_bar.png</file>
355356
</qresource>
356357
<qresource prefix="/images/tips">
357358
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
File renamed without changes.

src/app/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ SET(QGIS_APP_SRCS
2525
qgsdecorationcopyrightdialog.cpp
2626
qgsdecorationnortharrow.cpp
2727
qgsdecorationnortharrowdialog.cpp
28+
qgsdecorationscalebar.cpp
29+
qgsdecorationscalebardialog.cpp
2830
qgsembedlayerdialog.cpp
2931
qgsformannotationdialog.cpp
3032
qgsdelattrdialog.cpp
@@ -161,6 +163,8 @@ SET (QGIS_APP_MOC_HDRS
161163
qgsdecorationcopyrightdialog.h
162164
qgsdecorationnortharrow.h
163165
qgsdecorationnortharrowdialog.h
166+
qgsdecorationscalebar.h
167+
qgsdecorationscalebardialog.h
164168
qgsdelattrdialog.h
165169
qgsdisplayangle.h
166170
qgsembedlayerdialog.h

src/app/qgisapp.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
#include "qgsdatasourceuri.h"
117117
#include "qgsdecorationcopyright.h"
118118
#include "qgsdecorationnortharrow.h"
119+
#include "qgsdecorationscalebar.h"
119120
#include "qgsembedlayerdialog.h"
120121
#include "qgsencodingfiledialog.h"
121122
#include "qgsexception.h"
@@ -1475,6 +1476,7 @@ void QgisApp::setTheme( QString theThemeName )
14751476
mActionChangeLabelProperties->setIcon( getThemeIcon( "/mActionChangeLabelProperties.png" ) );
14761477
mActionDecorationCopyright->setIcon( getThemeIcon( "/plugins/copyright_label.png" ) );
14771478
mActionDecorationNorthArrow->setIcon( getThemeIcon( "/plugins/north_arrow.png" ) );
1479+
mActionDecorationScaleBar->setIcon( getThemeIcon( "/plugins/scale_bar.png" ) );
14781480

14791481
//change themes of all composers
14801482
QSet<QgsComposer*>::iterator composerIt = mPrintComposers.begin();
@@ -1819,6 +1821,11 @@ void QgisApp::createDecorations()
18191821
connect( mActionDecorationNorthArrow, SIGNAL( triggered() ), mDecorationNorthArrow, SLOT( run() ) );
18201822
connect( mMapCanvas, SIGNAL( renderComplete( QPainter * ) ), mDecorationNorthArrow, SLOT( renderNorthArrow( QPainter * ) ) );
18211823
connect( this, SIGNAL( projectRead() ), mDecorationNorthArrow, SLOT( projectRead() ) );
1824+
1825+
mDecorationScaleBar = new QgsDecorationScaleBar( this );
1826+
connect( mActionDecorationScaleBar, SIGNAL( triggered() ), mDecorationScaleBar, SLOT( run() ) );
1827+
connect( mMapCanvas, SIGNAL( renderComplete( QPainter * ) ), mDecorationScaleBar, SLOT( renderScaleBar( QPainter * ) ) );
1828+
connect( this, SIGNAL( projectRead() ), mDecorationScaleBar, SLOT( projectRead() ) );
18221829
}
18231830

18241831
// Update file menu with the current list of recently accessed projects

src/app/qgisapp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class QgsGPSInformationWidget;
7171

7272
class QgsDecorationCopyright;
7373
class QgsDecorationNorthArrow;
74+
class QgsDecorationScaleBar;
7475

7576
#include <QMainWindow>
7677
#include <QToolBar>
@@ -1057,6 +1058,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
10571058

10581059
QgsDecorationCopyright* mDecorationCopyright;
10591060
QgsDecorationNorthArrow* mDecorationNorthArrow;
1061+
QgsDecorationScaleBar* mDecorationScaleBar;
10601062

10611063
int mLastComposerId;
10621064

0 commit comments

Comments
 (0)