[FEATURE] add search bar to the Configure Shortcuts dialog (fix #12681)

Supports search by action name and by shortcut
This commit is contained in:
Alexander Bruy 2016-12-30 10:40:19 +02:00
parent 248e7d1d5e
commit 1fb9ef6ca5
3 changed files with 32 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include <QFileDialog>
#include <QTextStream>
#include <QSettings>
#include <QDebug>
QgsConfigureShortcutsDialog::QgsConfigureShortcutsDialog( QWidget* parent, QgsShortcutsManager* manager )
: QDialog( parent )
@ -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 );
}
}
}

View File

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

View File

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