mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
StringsWidget: add shortcuts for QuickFilter (#973)
This commit is contained in:
parent
3c78586438
commit
3fa101d9ee
@ -26,3 +26,21 @@ QComboBox *ComboQuickFilterView::comboBox()
|
||||
{
|
||||
return ui->comboBox;
|
||||
}
|
||||
|
||||
void ComboQuickFilterView::showFilter()
|
||||
{
|
||||
show();
|
||||
ui->lineEdit->setFocus();
|
||||
}
|
||||
|
||||
void ComboQuickFilterView::clearFilter()
|
||||
{
|
||||
ui->lineEdit->setText("");
|
||||
}
|
||||
|
||||
void ComboQuickFilterView::closeFilter()
|
||||
{
|
||||
ui->lineEdit->setText("");
|
||||
hide();
|
||||
emit filterClosed();
|
||||
}
|
||||
|
@ -19,8 +19,14 @@ public:
|
||||
void setLabelText(const QString &text);
|
||||
QComboBox *comboBox();
|
||||
|
||||
public slots:
|
||||
void showFilter();
|
||||
void closeFilter();
|
||||
void clearFilter();
|
||||
|
||||
signals:
|
||||
void filterTextChanged(const QString &text);
|
||||
void filterClosed();
|
||||
|
||||
private:
|
||||
Ui::ComboQuickFilterView *ui;
|
||||
|
@ -178,6 +178,14 @@ StringsWidget::StringsWidget(MainWindow *main, QAction *action) :
|
||||
tree->showItemsNumber(proxyModel->rowCount());
|
||||
});
|
||||
|
||||
QShortcut *searchShortcut = new QShortcut(QKeySequence::Find, this);
|
||||
connect(searchShortcut, &QShortcut::activated, ui->quickFilterView, &ComboQuickFilterView::showFilter);
|
||||
searchShortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
|
||||
QShortcut *clearShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
||||
connect(clearShortcut, &QShortcut::activated, ui->quickFilterView, &ComboQuickFilterView::clearFilter);
|
||||
clearShortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
|
||||
connect(Core(), SIGNAL(refreshAll()), this, SLOT(refreshStrings()));
|
||||
|
||||
connect(
|
||||
|
Loading…
Reference in New Issue
Block a user