mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-23 17:55:43 -05:00
Only emit signals when value changed
* Fixes crash when deleting macro in case macro selection is in focus * Prevent unnecessary create operation when switching macro segment type
This commit is contained in:
@@ -84,8 +84,7 @@ void FilterComboBox::focusOutEvent(QFocusEvent *event)
|
||||
// Reset on invalid selection
|
||||
if (findText(currentText()) == -1) {
|
||||
setCurrentIndex(-1);
|
||||
emit currentIndexChanged(-1);
|
||||
emit currentTextChanged("");
|
||||
Emit(-1, "");
|
||||
}
|
||||
|
||||
QComboBox::focusOutEvent(event);
|
||||
@@ -121,8 +120,7 @@ void FilterComboBox::CompleterHighlightChanged(const QModelIndex &index)
|
||||
if (idx == -1) {
|
||||
return;
|
||||
}
|
||||
emit currentIndexChanged(idx);
|
||||
emit currentTextChanged(text);
|
||||
Emit(idx, text);
|
||||
}
|
||||
|
||||
void FilterComboBox::TextChanged(const QString &text)
|
||||
@@ -134,8 +132,18 @@ void FilterComboBox::TextChanged(const QString &text)
|
||||
if (idx == -1) {
|
||||
return;
|
||||
}
|
||||
emit currentIndexChanged(idx);
|
||||
emit currentTextChanged(text);
|
||||
}
|
||||
|
||||
void FilterComboBox::Emit(int index, const QString &text)
|
||||
{
|
||||
if (_lastEmittedIndex != index) {
|
||||
_lastEmittedIndex = index;
|
||||
emit currentIndexChanged(index);
|
||||
}
|
||||
if (_lastEmittedText != text) {
|
||||
_lastEmittedText = text;
|
||||
emit currentTextChanged(text);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
||||
Reference in New Issue
Block a user