mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 12:02:48 +01:00
Add support for returnPressed() signal to QSearchField.
This commit is contained in:
parent
20d740f385
commit
1e620321a3
1
3rdparty/qocoa/qsearchfield.h
vendored
1
3rdparty/qocoa/qsearchfield.h
vendored
@ -22,6 +22,7 @@ public slots:
|
||||
signals:
|
||||
void textChanged(const QString &text);
|
||||
void editingFinished();
|
||||
void returnPressed();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent*);
|
||||
|
10
3rdparty/qocoa/qsearchfield_mac.mm
vendored
10
3rdparty/qocoa/qsearchfield_mac.mm
vendored
@ -46,6 +46,12 @@ public:
|
||||
emit qSearchField->editingFinished();
|
||||
}
|
||||
|
||||
void returnPressed()
|
||||
{
|
||||
if (qSearchField)
|
||||
emit qSearchField->returnPressed();
|
||||
}
|
||||
|
||||
QPointer<QSearchField> qSearchField;
|
||||
NSSearchField *nsSearchField;
|
||||
};
|
||||
@ -67,10 +73,12 @@ public:
|
||||
}
|
||||
|
||||
-(void)controlTextDidEndEditing:(NSNotification*)notification {
|
||||
Q_UNUSED(notification);
|
||||
// No Q_ASSERT here as it is called on destruction.
|
||||
if (pimpl)
|
||||
pimpl->textDidEndEditing();
|
||||
|
||||
if ([[[notification userInfo] objectForKey:@"NSTextMovement"] intValue] == NSReturnTextMovement)
|
||||
pimpl->returnPressed();
|
||||
}
|
||||
@end
|
||||
|
||||
|
2
3rdparty/qocoa/qsearchfield_nonmac.cpp
vendored
2
3rdparty/qocoa/qsearchfield_nonmac.cpp
vendored
@ -55,6 +55,8 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent)
|
||||
this, SIGNAL(textChanged(QString)));
|
||||
connect(lineEdit, SIGNAL(editingFinished()),
|
||||
this, SIGNAL(editingFinished()));
|
||||
connect(lineEdit, SIGNAL(returnPressed()),
|
||||
this, SIGNAL(returnPressed()));
|
||||
connect(lineEdit, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(setText(QString)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user