mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 20:06:12 +00:00
Add Quick Filter to StringsWidget #162
This commit is contained in:
parent
f694daac88
commit
15a1a6bd9c
@ -333,12 +333,12 @@ FunctionsWidget::FunctionsWidget(MainWindow *main, QWidget *parent) :
|
||||
//ui->filterLineEdit->setVisible(false);
|
||||
|
||||
// Ctrl-F to show/hide the filter entry
|
||||
QShortcut *search_shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F), this);
|
||||
QShortcut *search_shortcut = new QShortcut(QKeySequence::Find, this);
|
||||
connect(search_shortcut, &QShortcut::activated, ui->quickFilterView, &QuickFilterView::showFilter);
|
||||
search_shortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
|
||||
// Esc to clear the filter entry
|
||||
QShortcut *clear_shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
||||
QShortcut *clear_shortcut = new QShortcut(QKeySequence::Cancel, this);
|
||||
connect(clear_shortcut, &QShortcut::activated, ui->quickFilterView, &QuickFilterView::clearFilter);
|
||||
clear_shortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
|
||||
|
@ -126,11 +126,24 @@ StringsWidget::StringsWidget(QWidget *parent) :
|
||||
|
||||
qhelpers::setVerticalScrollMode(ui->stringsTreeView);
|
||||
|
||||
// Ctrl-F to show/hide the filter entry
|
||||
QShortcut *search_shortcut = new QShortcut(QKeySequence::Find, this);
|
||||
connect(search_shortcut, &QShortcut::activated, ui->quickFilterView, &QuickFilterView::showFilter);
|
||||
search_shortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
|
||||
// Esc to clear the filter entry
|
||||
QShortcut *clear_shortcut = new QShortcut(QKeySequence::Cancel, this);
|
||||
connect(clear_shortcut, &QShortcut::activated, ui->quickFilterView, &QuickFilterView::clearFilter);
|
||||
clear_shortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
|
||||
model = new StringsModel(&strings, this);
|
||||
proxy_model = new StringsSortFilterProxyModel(model, this);
|
||||
ui->stringsTreeView->setModel(proxy_model);
|
||||
ui->stringsTreeView->sortByColumn(StringsModel::OFFSET, Qt::AscendingOrder);
|
||||
|
||||
connect(ui->quickFilterView, SIGNAL(filterTextChanged(const QString &)), proxy_model, SLOT(setFilterWildcard(const QString &)));
|
||||
connect(ui->quickFilterView, SIGNAL(filterClosed()), ui->stringsTreeView, SLOT(setFocus()));
|
||||
|
||||
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshStrings()));
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,9 @@
|
||||
</property>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -56,9 +59,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QuickFilterView" name="quickFilterView" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QuickFilterView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>widgets/QuickFilterView.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user