Skip to content
Permalink
Browse files
Shortcuts dialog now remembers window state between uses
  • Loading branch information
spilth committed Aug 9, 2011
1 parent 43e8321 commit e5f9462a02f834807080c39fa6d057058fa1e7c4
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 e5f9462

Please sign in to comment.