Skip to content

Commit

Permalink
Merge pull request #3925 from alexbruy/shortcuts-search
Browse files Browse the repository at this point in the history
[FEATURE] add search bar to the Configure Shortcuts dialog (fix #12681)
  • Loading branch information
alexbruy committed Jan 3, 2017
2 parents a643f4b + 1fb9ef6 commit 47130a6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/gui/qgsconfigureshortcutsdialog.cpp
Expand Up @@ -28,6 +28,7 @@
#include <QFileDialog>
#include <QTextStream>
#include <QSettings>
#include <QDebug>

QgsConfigureShortcutsDialog::QgsConfigureShortcutsDialog( QWidget* parent, QgsShortcutsManager* manager )
: QDialog( parent )
Expand Down Expand Up @@ -480,3 +481,19 @@ void QgsConfigureShortcutsDialog::setCurrentActionShortcut( const QKeySequence&

actionChanged( treeActions->currentItem(), nullptr );
}

void QgsConfigureShortcutsDialog::on_mLeFilter_textChanged( const QString& text )
{
for ( int i = 0; i < treeActions->topLevelItemCount(); i++ )
{
QTreeWidgetItem* item = treeActions->topLevelItem( i );
if ( !item->text( 0 ).contains( text, Qt::CaseInsensitive ) && !item->text( 1 ).contains( text, Qt::CaseInsensitive ) )
{
item->setHidden( true );
}
else
{
item->setHidden( false );
}
}
}
1 change: 1 addition & 0 deletions src/gui/qgsconfigureshortcutsdialog.h
Expand Up @@ -54,6 +54,7 @@ class GUI_EXPORT QgsConfigureShortcutsDialog : public QDialog, private Ui::QgsCo
void setNoShortcut();
void saveShortcuts();
void loadShortcuts();
void on_mLeFilter_textChanged( const QString& text );

void actionChanged( QTreeWidgetItem* current, QTreeWidgetItem* previous );

Expand Down
14 changes: 14 additions & 0 deletions src/ui/qgsconfigureshortcutsdialog.ui
Expand Up @@ -14,6 +14,13 @@
<string>Keyboard shortcuts</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QgsFilterLineEdit" name="mLeFilter">
<property name="placeholderText">
<string>Search...</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="treeActions">
<property name="rootIsDecorated">
Expand Down Expand Up @@ -110,6 +117,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsFilterLineEdit</class>
<extends>QLineEdit</extends>
<header>qgsfilterlineedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>treeActions</tabstop>
<tabstop>btnSetNoShortcut</tabstop>
Expand Down

0 comments on commit 47130a6

Please sign in to comment.