mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Make sure to not re-run the query if the filters haven't changed
When changing between the filter line edits in the Browse Data tab, make sure to only re-run the SQL query if the value of the filter line edits have actually changed. See issue #1187.
This commit is contained in:
@@ -30,8 +30,16 @@ void FilterLineEdit::delayedSignalTimerTriggered()
|
||||
// Stop the timer first to avoid triggering in intervals
|
||||
delaySignalTimer->stop();
|
||||
|
||||
// Emit the delayed signal using the current value
|
||||
emit delayedTextChanged(text());
|
||||
// Only emit text changed signal if the text has actually changed in comparison to the last emitted signal. This is necessary
|
||||
// because this method is also called whenever the line edit loses focus and not only when its text has definitely been changed.
|
||||
if(text() != lastValue)
|
||||
{
|
||||
// Emit the delayed signal using the current value
|
||||
emit delayedTextChanged(text());
|
||||
|
||||
// Remember this value for the next time
|
||||
lastValue = text();
|
||||
}
|
||||
}
|
||||
|
||||
void FilterLineEdit::keyReleaseEvent(QKeyEvent* event)
|
||||
|
||||
@@ -31,6 +31,7 @@ private:
|
||||
QList<FilterLineEdit*>* filterList;
|
||||
int columnNumber;
|
||||
QTimer* delaySignalTimer;
|
||||
QString lastValue;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user