Skip to content

Instantly share code, notes, and snippets.

@NathanW2
Created May 7, 2012 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NathanW2/2626655 to your computer and use it in GitHub Desktop.
Save NathanW2/2626655 to your computer and use it in GitHub Desktop.
Scale
diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp
index bf22859..6e471d3 100644
--- a/src/app/qgisapp.cpp
+++ b/src/app/qgisapp.cpp
@@ -6246,6 +6246,8 @@ void QgisApp::projectProperties()
// It is needed to refresh scale bar after changing display units.
connect( pp, SIGNAL( refresh() ), mMapCanvas, SLOT( refresh() ) );
+ connect( pp, SIGNAL( userScalesChanged() ) , mScaleEdit, SLOT( updateScales() ) );
+
QgsMapRenderer* myRender = mMapCanvas->mapRenderer();
bool wasProjected = myRender->hasCrsTransformEnabled();
long oldCRSID = myRender->destinationCrs().srsid();
diff --git a/src/app/qgsprojectproperties.h b/src/app/qgsprojectproperties.h
index 899c64a..85db25e 100644
--- a/src/app/qgsprojectproperties.h
+++ b/src/app/qgsprojectproperties.h
@@ -107,6 +107,9 @@ class QgsProjectProperties : public QDialog, private Ui::QgsProjectPropertiesBas
//! Signal used to inform listeners that the mouse display precision may have changed
void displayPrecisionChanged();
+ /** Signal eimited when the user defined scales change */
+ void userScalesChanged();
+
//! let listening canvases know to refresh
void refresh();
diff --git a/src/gui/qgsscalecombobox.cpp b/src/gui/qgsscalecombobox.cpp
index 5d9e5eb..0d2b223 100644
--- a/src/gui/qgsscalecombobox.cpp
+++ b/src/gui/qgsscalecombobox.cpp
@@ -18,6 +18,7 @@
#include "qgsscalecombobox.h"
#include <QAbstractItemView>
+#include <QSettings>
QgsScaleComboBox::QgsScaleComboBox( QWidget* parent ) : QComboBox( parent )
{
@@ -68,3 +69,8 @@ void QgsScaleComboBox::showPopup()
view()->setCurrentIndex( model()->index( idx, 0 ) );
blockSignals( false );
}
+
+void QgsScaleComboBox::updateScales()
+{
+ // READ THE SCALES FROM THE PROJECT FILE OR SOME OTHER WAY
+}
diff --git a/src/gui/qgsscalecombobox.h b/src/gui/qgsscalecombobox.h
index b1623a6..10fd054 100644
--- a/src/gui/qgsscalecombobox.h
+++ b/src/gui/qgsscalecombobox.h
@@ -33,6 +33,10 @@ class GUI_EXPORT QgsScaleComboBox : public QComboBox
protected:
void showPopup();
+
+ public slots:
+ void updateScales();
+
};
#endif // QGSSCALECOMBOBOX_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment