Support selectAll() in QSearchField.
This commit is contained in:
parent
1e620321a3
commit
e928ac0349
3
3rdparty/qocoa/qsearchfield.h
vendored
3
3rdparty/qocoa/qsearchfield.h
vendored
@ -17,8 +17,9 @@ public:
|
||||
public slots:
|
||||
void setText(const QString &text);
|
||||
void setPlaceholderText(const QString &text);
|
||||
|
||||
void clear();
|
||||
void selectAll();
|
||||
|
||||
signals:
|
||||
void textChanged(const QString &text);
|
||||
void editingFinished();
|
||||
|
9
3rdparty/qocoa/qsearchfield_mac.mm
vendored
9
3rdparty/qocoa/qsearchfield_mac.mm
vendored
@ -140,6 +140,15 @@ void QSearchField::clear()
|
||||
emit textChanged(QString());
|
||||
}
|
||||
|
||||
void QSearchField::selectAll()
|
||||
{
|
||||
Q_ASSERT(pimpl);
|
||||
if (!pimpl)
|
||||
return;
|
||||
|
||||
[pimpl->nsSearchField performSelector:@selector(selectText:)];
|
||||
}
|
||||
|
||||
QString QSearchField::text() const
|
||||
{
|
||||
Q_ASSERT(pimpl);
|
||||
|
9
3rdparty/qocoa/qsearchfield_nonmac.cpp
vendored
9
3rdparty/qocoa/qsearchfield_nonmac.cpp
vendored
@ -117,6 +117,15 @@ void QSearchField::clear()
|
||||
pimpl->lineEdit->clear();
|
||||
}
|
||||
|
||||
void QSearchField::selectAll()
|
||||
{
|
||||
Q_ASSERT(pimpl && pimpl->lineEdit);
|
||||
if (!(pimpl && pimpl->lineEdit))
|
||||
return;
|
||||
|
||||
pimpl->lineEdit->clear();
|
||||
}
|
||||
|
||||
QString QSearchField::text() const
|
||||
{
|
||||
Q_ASSERT(pimpl && pimpl->lineEdit);
|
||||
|
@ -481,7 +481,7 @@ void GlobalSearchView::showEvent(QShowEvent* e) {
|
||||
|
||||
void GlobalSearchView::FocusSearchField() {
|
||||
ui_->search->setFocus();
|
||||
//ui_->search->selectAll();
|
||||
ui_->search->selectAll();
|
||||
}
|
||||
|
||||
void GlobalSearchView::hideEvent(QHideEvent* e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user