aboutsummaryrefslogtreecommitdiff
path: root/src/qt/monitoreddatamapper.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/monitoreddatamapper.h')
-rw-r--r--src/qt/monitoreddatamapper.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/qt/monitoreddatamapper.h b/src/qt/monitoreddatamapper.h
new file mode 100644
index 0000000000..33a874e73a
--- /dev/null
+++ b/src/qt/monitoreddatamapper.h
@@ -0,0 +1,31 @@
+#ifndef MONITOREDDATAMAPPER_H
+#define MONITOREDDATAMAPPER_H
+
+#include <QDataWidgetMapper>
+
+QT_BEGIN_NAMESPACE
+class QWidget;
+QT_END_NAMESPACE
+
+/** Data to Widget mapper that watches for edits and notifies listeners when a field is edited.
+ This can be used, for example, to enable a commit/apply button in a configuration dialog.
+ */
+class MonitoredDataMapper : public QDataWidgetMapper
+{
+ Q_OBJECT
+public:
+ explicit MonitoredDataMapper(QObject *parent=0);
+
+ void addMapping(QWidget *widget, int section);
+ void addMapping(QWidget *widget, int section, const QByteArray &propertyName);
+private:
+ void addChangeMonitor(QWidget *widget);
+
+signals:
+ void viewModified();
+
+};
+
+
+
+#endif // MONITOREDDATAMAPPER_H