X-Git-Url: http://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fprop%2Fstring.cpp;fp=pv%2Fprop%2Fstring.cpp;h=511fe6c4352de19356c36604b5d1479e8ab46319;hp=7fcc656958b9fed74d6f91c89f29e2ebe58d429e;hb=e8d009288de28cb194bc7964f96677c2baf900c9;hpb=87b79835014a386fb51b52bc993dbb693bd27197 diff --git a/pv/prop/string.cpp b/pv/prop/string.cpp index 7fcc6569..511fe6c4 100644 --- a/pv/prop/string.cpp +++ b/pv/prop/string.cpp @@ -25,6 +25,10 @@ #include "string.h" +using std::string; + +using Glib::ustring; + namespace pv { namespace prop { @@ -41,14 +45,18 @@ QWidget* String::get_widget(QWidget *parent, bool auto_commit) if (_line_edit) return _line_edit; - GVariant *const value = _getter ? _getter() : NULL; - if (!value) + if (!_getter) return NULL; + Glib::VariantBase variant = _getter(); + if (!variant.gobj()) + return NULL; + + string value = Glib::VariantBase::cast_dynamic>( + variant).get(); + _line_edit = new QLineEdit(parent); - _line_edit->setText(QString::fromUtf8( - g_variant_get_string(value, NULL))); - g_variant_unref(value); + _line_edit->setText(QString::fromStdString(value)); if (auto_commit) connect(_line_edit, SIGNAL(textEdited(const QString&)), @@ -65,7 +73,7 @@ void String::commit() return; QByteArray ba = _line_edit->text().toLocal8Bit(); - _setter(g_variant_new_string(ba.data())); + _setter(Glib::Variant::create(ba.data())); } void String::on_text_edited(const QString&)