mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Merge pull request #8980 from silverqx/clear-on-esc
Clear LineEdit on ESC
This commit is contained in:
commit
305c1fc851
@ -40,3 +40,11 @@ void LineEdit::resizeEvent(QResizeEvent *e)
|
|||||||
const int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
const int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||||
m_searchButton->move(frameWidth, (e->size().height() - m_searchButton->sizeHint().height()) / 2);
|
m_searchButton->move(frameWidth, (e->size().height() - m_searchButton->sizeHint().height()) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LineEdit::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if ((event->modifiers() == Qt::NoModifier) && (event->key() == Qt::Key_Escape)) {
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
QLineEdit::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
@ -23,6 +23,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QToolButton *m_searchButton;
|
QToolButton *m_searchButton;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user