Use QgisApp::instance and simplify code

This commit is contained in:
Médéric RIBREUX 2015-11-25 18:35:59 +01:00 committed by Matthias Kuhn
parent 09c8239a77
commit 055ef76a68
2 changed files with 14 additions and 0 deletions

View File

@ -14,6 +14,7 @@
* *
***************************************************************************/
#include "qgisapp.h"
#include "qgsmeasuredialog.h"
#include "qgsmeasuretool.h"
@ -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.;
@ -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;

View File

@ -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