aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio/common/lazytrigger.h
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@ubuntu.com>2018-07-27 23:51:12 -0400
committerLibravatarUnit 193 <unit193@ubuntu.com>2018-07-27 23:51:12 -0400
commitfeda8a7db8d1d7c5439aa8f8feef7cc0dd2b59a0 (patch)
tree1e50f5f666f419143f510d5ded00fe2006b7bd85 /SQLiteStudio3/coreSQLiteStudio/common/lazytrigger.h
parentd9aa870e5d509cc7309ab82dd102a937ab58613a (diff)
New upstream version 3.2.1+dfsg1upstream/3.2.1+dfsg1
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio/common/lazytrigger.h')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/lazytrigger.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/lazytrigger.h b/SQLiteStudio3/coreSQLiteStudio/common/lazytrigger.h
new file mode 100644
index 0000000..9c34395
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/common/lazytrigger.h
@@ -0,0 +1,34 @@
+#ifndef LAZYTRIGGER_H
+#define LAZYTRIGGER_H
+
+#include "coreSQLiteStudio_global.h"
+#include <QObject>
+#include <functional>
+
+class QTimer;
+
+class API_EXPORT LazyTrigger : public QObject
+{
+ Q_OBJECT
+
+ public:
+ typedef std::function<bool()> Condition;
+
+ LazyTrigger(int delay, QObject* parent = nullptr, const char* slot = nullptr);
+ LazyTrigger(int delay, Condition condition, QObject* parent = nullptr, const char* slot = nullptr);
+
+ void setDelay(int delay);
+
+ private:
+ QTimer* timer = nullptr;
+ Condition condition = nullptr;
+
+ public slots:
+ void schedule();
+ void cancel();
+
+ signals:
+ void triggered();
+};
+
+#endif // LAZYTRIGGER_H