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