mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Improved functions filter show/hide
This commit is contained in:
parent
a3adfab8c3
commit
117d547570
@ -335,7 +335,7 @@ FunctionsWidget::FunctionsWidget(MainWindow *main, QWidget *parent) :
|
|||||||
|
|
||||||
// Ctrl-F to show/hide the filter entry
|
// 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(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);
|
search_shortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||||
|
|
||||||
// Esc to clear the filter entry
|
// Esc to clear the filter entry
|
||||||
@ -617,21 +617,25 @@ void FunctionsWidget::setScrollMode()
|
|||||||
qhelpers::setVerticalScrollMode(ui->functionsTreeView);
|
qhelpers::setVerticalScrollMode(ui->functionsTreeView);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionsWidget::toggle_visibility() {
|
void FunctionsWidget::show_filter() {
|
||||||
if (ui->filterLineEdit->isVisible()) {
|
ui->filterLineEdit->setVisible(true);
|
||||||
ui->filterLineEdit->setVisible(false);
|
ui->closeFilterButton->setVisible(true);
|
||||||
ui->functionsTreeView->setFocus();
|
ui->filterLineEdit->setFocus();
|
||||||
} else {
|
|
||||||
ui->filterLineEdit->setVisible(true);
|
|
||||||
ui->filterLineEdit->setFocus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FunctionsWidget::clear_filter() {
|
void FunctionsWidget::clear_filter() {
|
||||||
if (ui->filterLineEdit->text() == "") {
|
if (ui->filterLineEdit->text() == "") {
|
||||||
ui->filterLineEdit->setVisible(false);
|
ui->filterLineEdit->setVisible(false);
|
||||||
|
ui->closeFilterButton->setVisible(false);
|
||||||
ui->functionsTreeView->setFocus();
|
ui->functionsTreeView->setFocus();
|
||||||
} else {
|
} else {
|
||||||
ui->filterLineEdit->setText("");
|
ui->filterLineEdit->setText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FunctionsWidget::on_closeFilterButton_clicked()
|
||||||
|
{
|
||||||
|
ui->filterLineEdit->setVisible(false);
|
||||||
|
ui->closeFilterButton->setVisible(false);
|
||||||
|
ui->functionsTreeView->setFocus();
|
||||||
|
}
|
||||||
|
@ -103,10 +103,12 @@ private slots:
|
|||||||
|
|
||||||
void on_actionVertical_triggered();
|
void on_actionVertical_triggered();
|
||||||
|
|
||||||
void toggle_visibility();
|
void show_filter();
|
||||||
|
|
||||||
void clear_filter();
|
void clear_filter();
|
||||||
|
|
||||||
|
void on_closeFilterButton_clicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *event) override;
|
void resizeEvent(QResizeEvent *event) override;
|
||||||
|
|
||||||
|
@ -192,14 +192,62 @@ QToolTip {
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="filterLineEdit">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="placeholderText">
|
<property name="spacing">
|
||||||
<string>Quick Filter</string>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="clearButtonEnabled">
|
<property name="rightMargin">
|
||||||
<bool>true</bool>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<item>
|
||||||
|
<widget class="QLineEdit" name="filterLineEdit">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Quick Filter</string>
|
||||||
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="closeFilterButton">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<italic>false</italic>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="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;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>X</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user