mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 20:06:12 +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(false);
|
|
||||||
ui->functionsTreeView->setFocus();
|
|
||||||
} else {
|
|
||||||
ui->filterLineEdit->setVisible(true);
|
ui->filterLineEdit->setVisible(true);
|
||||||
|
ui->closeFilterButton->setVisible(true);
|
||||||
ui->filterLineEdit->setFocus();
|
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;
|
||||||
|
|
||||||
|
@ -191,6 +191,14 @@ QToolTip {
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="filterLineEdit">
|
<widget class="QLineEdit" name="filterLineEdit">
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
@ -201,6 +209,46 @@ QToolTip {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<action name="actionDisasAdd_comment">
|
<action name="actionDisasAdd_comment">
|
||||||
|
Loading…
Reference in New Issue
Block a user