]> sigrok.org Git - pulseview.git/blobdiff - pv/prop/string.cpp
Replaced Decoder internal GHashTable storage of options with a std::map
[pulseview.git] / pv / prop / string.cpp
index b9de789b90298042104bd0b60b2ea94e8bd45668..c2b2c67c26a5c97377dff2b853759206ef65ffe7 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <assert.h>
 
+#include <QLineEdit>
 #include <QSpinBox>
 
 #include "string.h"
@@ -38,7 +39,7 @@ String::String(QString name,
 {
 }
 
-QWidget* String::get_widget(QWidget *parent)
+QWidget* String::get_widget(QWidget *parent, bool auto_commit)
 {
        if (_line_edit)
                return _line_edit;
@@ -52,6 +53,10 @@ QWidget* String::get_widget(QWidget *parent)
                g_variant_unref(value);
        }
 
+       if (auto_commit)
+               connect(_line_edit, SIGNAL(textEdited(const QString&)),
+                       this, SLOT(on_text_edited(const QString&)));
+
        return _line_edit;
 }
 
@@ -66,5 +71,10 @@ void String::commit()
        _setter(g_variant_new_string(ba.data()));
 }
 
+void String::on_text_edited(const QString&)
+{
+       commit();
+}
+
 } // prop
 } // pv