mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
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:
@@ -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()));
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ void PreferencesDialog::loadSettings()
|
||||
|
||||
ui->txtNull->setText(getSettingsValue("databrowser", "null_text").toString());
|
||||
ui->editFilterEscape->setText(getSettingsValue("databrowser", "filter_escape").toString());
|
||||
ui->spinFilterDelay->setValue(getSettingsValue("databrowser", "filter_delay").toInt());
|
||||
|
||||
for(int i=0; i < ui->treeSyntaxHighlighting->topLevelItemCount(); ++i)
|
||||
{
|
||||
@@ -125,6 +126,7 @@ void PreferencesDialog::saveSettings()
|
||||
saveColorSetting(ui->fr_bin_bg, "bin_bg");
|
||||
setSettingsValue("databrowser", "null_text", ui->txtNull->text());
|
||||
setSettingsValue("databrowser", "filter_escape", ui->editFilterEscape->text());
|
||||
setSettingsValue("databrowser", "filter_delay", ui->spinFilterDelay->value());
|
||||
|
||||
for(int i=0; i < ui->treeSyntaxHighlighting->topLevelItemCount(); ++i)
|
||||
{
|
||||
@@ -258,21 +260,23 @@ QVariant PreferencesDialog::getSettingsDefaultValue(const QString& group, const
|
||||
return "Sans Serif";
|
||||
if(name == "fontsize")
|
||||
return 10;
|
||||
if (name == "null_text")
|
||||
if(name == "null_text")
|
||||
return "NULL";
|
||||
if (name == "filter_escape")
|
||||
if(name == "filter_escape")
|
||||
return "\\";
|
||||
if (name == "null_fg_colour")
|
||||
if(name == "filter_delay")
|
||||
return 200;
|
||||
if(name == "null_fg_colour")
|
||||
return QColor(Qt::lightGray).name();
|
||||
if (name == "null_bg_colour")
|
||||
if(name == "null_bg_colour")
|
||||
return QColor(Qt::white).name();
|
||||
if (name == "reg_fg_colour")
|
||||
if(name == "reg_fg_colour")
|
||||
return QColor(Qt::black).name();
|
||||
if (name == "reg_bg_colour")
|
||||
if(name == "reg_bg_colour")
|
||||
return QColor(Qt::white).name();
|
||||
if (name == "bin_fg_colour")
|
||||
if(name == "bin_fg_colour")
|
||||
return QColor(Qt::lightGray).name();
|
||||
if (name == "bin_bg_colour")
|
||||
if(name == "bin_bg_colour")
|
||||
return QColor(Qt::white).name();
|
||||
}
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="SqlTextEdit" name="editDatabaseDefaultSqlText" native="true">
|
||||
<widget class="SqlTextEdit" name="editDatabaseDefaultSqlText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
@@ -532,14 +532,14 @@
|
||||
<string>Filters</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="gridLayout_4">
|
||||
<item row="0" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="editFilterEscape">
|
||||
<property name="maxLength">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_18">
|
||||
<property name="text">
|
||||
<string>Escape character</string>
|
||||
@@ -549,6 +549,26 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_19">
|
||||
<property name="text">
|
||||
<string>Delay time (&ms)</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>spinFilterDelay</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinFilterDelay">
|
||||
<property name="toolTip">
|
||||
<string>Set the waiting time before a new filter value is applied. Can be set to 0 for disabling waiting.</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>5000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -927,7 +947,7 @@
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>SqlTextEdit</class>
|
||||
<extends>QWidget</extends>
|
||||
<extends>QTextEdit</extends>
|
||||
<header>sqltextedit.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
@@ -1007,8 +1027,8 @@
|
||||
<slot>addExtension()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>571</x>
|
||||
<y>99</y>
|
||||
<x>115</x>
|
||||
<y>80</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>245</x>
|
||||
@@ -1023,8 +1043,8 @@
|
||||
<slot>removeExtension()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>571</x>
|
||||
<y>137</y>
|
||||
<x>115</x>
|
||||
<y>80</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>245</x>
|
||||
@@ -1039,8 +1059,8 @@
|
||||
<slot>showColourDialog(QTreeWidgetItem*,int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>111</x>
|
||||
<y>87</y>
|
||||
<x>103</x>
|
||||
<y>48</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>395</x>
|
||||
@@ -1071,12 +1091,12 @@
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>367</x>
|
||||
<y>189</y>
|
||||
<x>103</x>
|
||||
<y>53</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>205</x>
|
||||
<y>220</y>
|
||||
<x>15</x>
|
||||
<y>61</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
@@ -1087,12 +1107,12 @@
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>376</x>
|
||||
<y>191</y>
|
||||
<x>103</x>
|
||||
<y>53</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>331</x>
|
||||
<y>219</y>
|
||||
<x>103</x>
|
||||
<y>63</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
|
||||
Reference in New Issue
Block a user