]> sigrok.org Git - pulseview.git/blobdiff - pv/prop/property.h
property: add the necessary include file for std::function
[pulseview.git] / pv / prop / property.h
index e6745a10d903cf9b4726f83c2bd1d252cf741b8a..b3aa1a690b00c3e29e74140317169bc5b2ac195e 100644 (file)
@@ -21,6 +21,9 @@
 #ifndef PULSEVIEW_PV_PROP_PROPERTY_H
 #define PULSEVIEW_PV_PROP_PROPERTY_H
 
+#include <glib.h>
+
+#include <functional>
 #include <QString>
 #include <QWidget>
 
@@ -29,15 +32,29 @@ class QWidget;
 namespace pv {
 namespace prop {
 
-class Property
+class Property : public QObject
 {
+       Q_OBJECT;
+
+public:
+       typedef std::function<GVariant* ()> Getter;
+       typedef std::function<void (GVariant*)> Setter;
+
 protected:
-       Property(QString name);
+       Property(QString name, Getter getter, Setter setter);
 
 public:
        const QString& name() const;
 
-       virtual QWidget* get_widget(QWidget *parent) = 0;
+       virtual QWidget* get_widget(QWidget *parent,
+               bool auto_commit = false) = 0;
+       virtual bool labeled_widget() const;
+
+       virtual void commit() = 0;
+
+protected:
+       const Getter _getter;
+       const Setter _setter;
 
 private:
        QString _name;