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:
Martin Kleusberg
2017-10-22 18:29:54 +02:00
parent bc91126b2c
commit d126e86e81
2 changed files with 11 additions and 2 deletions

View File

@@ -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)

View File

@@ -31,6 +31,7 @@ private:
QList<FilterLineEdit*>* filterList;
int columnNumber;
QTimer* delaySignalTimer;
QString lastValue;
};
#endif