]> sigrok.org Git - pulseview.git/blobdiff - pv/prop/bool.cpp
Replaced using namespace with using class directives
[pulseview.git] / pv / prop / bool.cpp
index 95cbb96e0caceea6c82e37367f933b1481ba3762..ac142fd440403c6b015c441f6e6b1d13ae3923aa 100644 (file)
@@ -24,9 +24,6 @@
 
 #include "bool.h"
 
-using namespace std;
-using namespace boost;
-
 namespace pv {
 namespace prop {
 
@@ -36,7 +33,11 @@ Bool::Bool(QString name, Getter getter, Setter setter) :
 {
 }
 
-QWidget* Bool::get_widget(QWidget *parent)
+Bool::~Bool()
+{
+}
+
+QWidget* Bool::get_widget(QWidget *parent, bool auto_commit)
 {
        if (_check_box)
                return _check_box;
@@ -51,6 +52,10 @@ QWidget* Bool::get_widget(QWidget *parent)
                g_variant_unref(value);
        }
 
+       if (auto_commit)
+               connect(_check_box, SIGNAL(stateChanged(int)),
+                       this, SLOT(on_state_changed(int)));
+
        return _check_box;
 }
 
@@ -70,5 +75,10 @@ void Bool::commit()
                _check_box->checkState() == Qt::Checked));
 }
 
+void Bool::on_state_changed(int)
+{
+       commit();
+}
+
 } // prop
 } // pv