]> sigrok.org Git - pulseview.git/commitdiff
Moved popup text changed handler into base class, and made "Name" translatable
authorJoel Holdsworth <redacted>
Sat, 5 Oct 2013 11:00:47 +0000 (12:00 +0100)
committerJoel Holdsworth <redacted>
Sun, 13 Oct 2013 10:05:23 +0000 (11:05 +0100)
pv/view/signal.cpp
pv/view/signal.h
pv/view/trace.cpp
pv/view/trace.h

index 7c4a11e03eee9fc1082578d7ffa71a2d05563b5f..96417f2bdcd51a212713e59f5be414b274bbb156 100644 (file)
@@ -90,11 +90,5 @@ void Signal::populate_popup_form(QWidget *parent, QFormLayout *form)
        form->addRow(tr("Name"), _name_widget);
 }
 
-void Signal::on_text_changed(const QString &text)
-{
-       Trace::set_name(text);
-       text_changed();
-}
-
 } // namespace view
 } // namespace pv
index 540eb6eda38899b3027a9f3a4baac45ecb39b3ba..cdecd408a9f9c45e6de3f29f4a18004ff51db828 100644 (file)
@@ -60,9 +60,6 @@ public:
 
        virtual void populate_popup_form(QWidget *parent, QFormLayout *form);
 
-private slots:
-       void on_text_changed(const QString &text);
-
 protected:
        const sr_probe *const _probe;
 
index 28084544f6f4247aee1798e4081302f0f22d5b27..ebf28b6224c69a5786a760333b34dd99ec6d1f10 100644 (file)
@@ -213,7 +213,11 @@ void Trace::paint_axis(QPainter &p, int y, int left, int right)
 
 void Trace::populate_popup_form(QWidget *parent, QFormLayout *form)
 {
-       form->addRow("Name", new QLineEdit(parent));
+       QLineEdit *const name_edit = new QLineEdit(parent);
+       name_edit->setText(_name);
+       connect(name_edit, SIGNAL(textChanged(const QString&)),
+               this, SLOT(on_text_changed(const QString&)));
+       form->addRow(tr("Name"), name_edit);
 }
 
 void Trace::compute_text_size(QPainter &p)
@@ -260,6 +264,11 @@ void Trace::on_action_set_colour_triggered()
                set_colour(new_colour);
 }
 
+void Trace::on_text_changed(const QString &text)
+{
+       set_name(text);
+       text_changed();
+}
 
 } // namespace view
 } // namespace pv
index bae5d253619e783f0553f8365fa187dcd75affe3..462e8094048830439690f8214b68857711e53a04 100644 (file)
@@ -181,6 +181,8 @@ private slots:
 
        void on_action_set_colour_triggered();
 
+       void on_text_changed(const QString &text);
+
 signals:
        void text_changed();