Esc closes search if button has focus as well
This commit is contained in:
committed by
craig.p.drummond
parent
a35346af7f
commit
554a8aa2be
@@ -58,7 +58,7 @@ SearchWidget::SearchWidget(QWidget *p)
|
||||
edit=new LineEdit(this);
|
||||
edit->setPlaceholderText(i18n("Search..."));
|
||||
l->addWidget(edit);
|
||||
ToolButton *closeButton=new ToolButton(this);
|
||||
closeButton=new ToolButton(this);
|
||||
closeButton->setToolTip(i18n("Close Search Bar"));
|
||||
l->addWidget(closeButton);
|
||||
Icon icon=Icon("dialog-close");
|
||||
@@ -70,7 +70,7 @@ SearchWidget::SearchWidget(QWidget *p)
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
connect(edit, SIGNAL(textChanged(QString)), SIGNAL(textChanged(QString)));
|
||||
connect(edit, SIGNAL(returnPressed()), SIGNAL(returnPressed()));
|
||||
edit->installEventFilter(new EscKeyEventHandler(this));
|
||||
installEventFilter(new EscKeyEventHandler(this));
|
||||
}
|
||||
|
||||
void SearchWidget::toggle()
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define SEARRCHWIDGET_H
|
||||
|
||||
#include "lineedit.h"
|
||||
#include "toolbutton.h"
|
||||
#include <QSet>
|
||||
|
||||
class SearchWidget : public QWidget
|
||||
@@ -37,7 +38,7 @@ public:
|
||||
void setText(const QString &t) { edit->setText(t); }
|
||||
QString text() const { return edit->text(); }
|
||||
void setFocus() { edit->setFocus(); }
|
||||
bool hasFocus() const { return edit->hasFocus(); }
|
||||
bool hasFocus() const { return edit->hasFocus() || closeButton->hasFocus(); }
|
||||
|
||||
Q_SIGNALS:
|
||||
void textChanged(const QString &);
|
||||
@@ -51,6 +52,7 @@ public Q_SLOTS:
|
||||
|
||||
private:
|
||||
LineEdit *edit;
|
||||
ToolButton *closeButton;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user