Filters: Add settings option for the delay time

Introduce a new option in the Preferences dialog for setting the delay
time which the filter widgets are waiting for before applying the newly
set value.

Also reduce the default delay time from 300 to 200 ms.

See issue #490.
This commit is contained in:
Martin Kleusberg
2016-01-27 22:24:16 +01:00
parent d9d2f96c40
commit 93cdbd0f80
3 changed files with 52 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
#include "FilterLineEdit.h"
#include "PreferencesDialog.h"
#include <QTimer>
#include <QKeyEvent>
@@ -17,7 +18,7 @@ FilterLineEdit::FilterLineEdit(QWidget* parent, QList<FilterLineEdit*>* filters,
// is (re)started. As soon as the user stops typing the timer has a chance to trigger and call the
// delayedSignalTimerTriggered() method which then stops the timer and emits the delayed signal.
delaySignalTimer = new QTimer(this);
delaySignalTimer->setInterval(300); // This is the milliseconds of not-typing we want to wait before triggering
delaySignalTimer->setInterval(PreferencesDialog::getSettingsValue("databrowser", "filter_delay").toInt()); // This is the milliseconds of not-typing we want to wait before triggering
connect(this, SIGNAL(textChanged(QString)), delaySignalTimer, SLOT(start()));
connect(delaySignalTimer, SIGNAL(timeout()), this, SLOT(delayedSignalTimerTriggered()));