Skip to content

Commit

Permalink
Use QgisApp::instance and simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
Médéric RIBREUX authored and m-kuhn committed Nov 27, 2015
1 parent 09c8239 commit 055ef76
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/qgsmeasuredialog.cpp
Expand Up @@ -14,6 +14,7 @@
* *
***************************************************************************/

#include "qgisapp.h"
#include "qgsmeasuredialog.h"
#include "qgsmeasuretool.h"

Expand All @@ -40,6 +41,11 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WindowFlags f )
buttonBox->addButton( nb, QDialogButtonBox::ActionRole );
connect( nb, SIGNAL( clicked() ), this, SLOT( restart() ) );

// Add a configuration button
QPushButton* cb = new QPushButton( tr( "&Configuration" ) );
buttonBox->addButton( cb, QDialogButtonBox::ActionRole );
connect( cb, SIGNAL( clicked() ), this, SLOT( openConfigTab() ) );

mMeasureArea = tool->measureArea();
mTotal = 0.;

Expand All @@ -60,6 +66,11 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WindowFlags f )
groupBox->setCollapsed( true );
}

void QgsMeasureDialog::openConfigTab()
{
QgisApp::instance()->showOptionsDialog( this, "mOptionsPageMapTools" );
}

void QgsMeasureDialog::updateSettings()
{
QSettings settings;
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsmeasuredialog.h
Expand Up @@ -68,6 +68,9 @@ class APP_EXPORT QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
private slots:
void unitsChanged( const QString &units );

//! Open configuration tab
void openConfigTab();

private:

//! formats distance to most appropriate units
Expand Down

0 comments on commit 055ef76

Please sign in to comment.