diff --git a/src/widgets/functionswidget.cpp b/src/widgets/functionswidget.cpp index e8e0d054..2d718e6d 100644 --- a/src/widgets/functionswidget.cpp +++ b/src/widgets/functionswidget.cpp @@ -335,7 +335,7 @@ FunctionsWidget::FunctionsWidget(MainWindow *main, QWidget *parent) : // Ctrl-F to show/hide the filter entry QShortcut *search_shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F), this); - connect(search_shortcut, SIGNAL(activated()), this, SLOT(toggle_visibility())); + connect(search_shortcut, SIGNAL(activated()), this, SLOT(show_filter())); search_shortcut->setContext(Qt::WidgetWithChildrenShortcut); // Esc to clear the filter entry @@ -617,21 +617,25 @@ void FunctionsWidget::setScrollMode() qhelpers::setVerticalScrollMode(ui->functionsTreeView); } -void FunctionsWidget::toggle_visibility() { - if (ui->filterLineEdit->isVisible()) { - ui->filterLineEdit->setVisible(false); - ui->functionsTreeView->setFocus(); - } else { - ui->filterLineEdit->setVisible(true); - ui->filterLineEdit->setFocus(); - } +void FunctionsWidget::show_filter() { + ui->filterLineEdit->setVisible(true); + ui->closeFilterButton->setVisible(true); + ui->filterLineEdit->setFocus(); } void FunctionsWidget::clear_filter() { if (ui->filterLineEdit->text() == "") { ui->filterLineEdit->setVisible(false); + ui->closeFilterButton->setVisible(false); ui->functionsTreeView->setFocus(); } else { ui->filterLineEdit->setText(""); } } + +void FunctionsWidget::on_closeFilterButton_clicked() +{ + ui->filterLineEdit->setVisible(false); + ui->closeFilterButton->setVisible(false); + ui->functionsTreeView->setFocus(); +} diff --git a/src/widgets/functionswidget.h b/src/widgets/functionswidget.h index 92033fa3..404fc28f 100644 --- a/src/widgets/functionswidget.h +++ b/src/widgets/functionswidget.h @@ -103,10 +103,12 @@ private slots: void on_actionVertical_triggered(); - void toggle_visibility(); + void show_filter(); void clear_filter(); + void on_closeFilterButton_clicked(); + protected: void resizeEvent(QResizeEvent *event) override; diff --git a/src/widgets/functionswidget.ui b/src/widgets/functionswidget.ui index 302b6121..83ddddde 100644 --- a/src/widgets/functionswidget.ui +++ b/src/widgets/functionswidget.ui @@ -192,14 +192,62 @@ QToolTip { - - - Quick Filter + + + 0 - - true + + 2 - + + + + Quick Filter + + + true + + + + + + + + 75 + false + true + + + + QToolButton { /* all types of tool button */ + border: 2px solid #333; + border-left: 2px solid #333; + border-right: 2px solid #333; + background-color: #333; + color: rgb(255, 255, 255) +} + +QToolButton:hover { + border: 2px solid rgb(128, 128, 128); + border-left: 2px solid rgb(128, 128, 128); + border-right: 2px solid rgb(128, 128, 128); + background-color: rgb(128, 128, 128); + color: rgb(255, 255, 255) + } + +QToolButton:pressed { + border: 2px solid #2180a9; + border-left: 2px solid #2180a9; + border-right: 2px solid #2180a9; + background-color: #2180a9; +} + + + X + + + +