mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Add helpers which also update the lineEdit text of FilterComboBox
This commit is contained in:
parent
aa1b10425f
commit
e13b9b0aa7
|
|
@ -62,6 +62,23 @@ void FilterComboBox::SetFilterBehaviourEnabled(bool value)
|
|||
FilterComboBox::_filteringEnabled = value;
|
||||
}
|
||||
|
||||
void FilterComboBox::setCurrentText(const QString &text)
|
||||
{
|
||||
if (_filteringEnabled) {
|
||||
lineEdit()->setText(text);
|
||||
}
|
||||
QComboBox::setCurrentText(text);
|
||||
}
|
||||
|
||||
void FilterComboBox::setItemText(int index, const QString &text)
|
||||
{
|
||||
QComboBox::setItemText(index, text);
|
||||
if (_filteringEnabled && index == currentIndex()) {
|
||||
const QSignalBlocker b(this);
|
||||
lineEdit()->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
void FilterComboBox::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
// Reset on invalid selection
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ public:
|
|||
const QString &placehodler = "");
|
||||
static void SetFilterBehaviourEnabled(bool);
|
||||
|
||||
void setCurrentText(const QString &text);
|
||||
void setItemText(int index, const QString &text);
|
||||
|
||||
protected:
|
||||
void focusOutEvent(QFocusEvent *event) override;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user