Skip to content
Permalink
Browse files
Merge pull request #36 from spilth/master
Shortcuts dialog now remembers window state between uses
  • Loading branch information
wonder-sk committed Aug 10, 2011
2 parents 7196dfc + e5f9462 commit 2de610b3507bfa08ebeea8afd08a95ff20996f4f
Showing with 39 additions and 1 deletion.
  1. +25 −0 src/app/qgsconfigureshortcutsdialog.cpp
  2. +14 −1 src/app/qgsconfigureshortcutsdialog.h
@@ -43,8 +43,33 @@ QgsConfigureShortcutsDialog::QgsConfigureShortcutsDialog( QWidget* parent )
this, SLOT( actionChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ) );

populateActions();

restoreState();
}

QgsConfigureShortcutsDialog::~QgsConfigureShortcutsDialog()
{
saveState();
}

/*!
* Function to save dialog window state
*/
void QgsConfigureShortcutsDialog::saveState()
{
QSettings settings;
settings.setValue( "/Windows/ShortcutsDialog/geometry", saveGeometry() );
}

/*!
* Function to restore dialog window state
*/
void QgsConfigureShortcutsDialog::restoreState()
{
QSettings settings;
restoreGeometry( settings.value( "/Windows/ShortcutsDialog/geometry" ).toByteArray() );
}

void QgsConfigureShortcutsDialog::populateActions()
{
QList<QAction*> actions = QgsShortcutsManager::instance()->listActions();
@@ -26,7 +26,8 @@ class QgsConfigureShortcutsDialog : public QDialog, private Ui::QgsConfigureShor

public:
QgsConfigureShortcutsDialog( QWidget* parent = NULL );

~QgsConfigureShortcutsDialog();

void populateActions();

protected:
@@ -51,6 +52,18 @@ class QgsConfigureShortcutsDialog : public QDialog, private Ui::QgsConfigureShor
protected:
bool mGettingShortcut;
int mModifiers, mKey;

private:
/*!
* Function to save dialog window state
*/
void saveState();

/*!
* Function to restore dialog window state
*/
void restoreState();

};

#endif

0 comments on commit 2de610b

Please sign in to comment.