Use a generic approach when adding the "close on enter" hook for popups
[pulseview.git] / pv / view / trace.cpp
index d10448f3eac071b535df4c25148a42700eb70486..7aa199c6ec1ca89acd3cbff98c247f755ae5fe95 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <QApplication>
 #include <QFormLayout>
+#include <QKeyEvent>
 #include <QLineEdit>
 
 #include "trace.h"
@@ -263,6 +264,8 @@ void Trace::populate_popup_form(QWidget *parent, QFormLayout *form)
 {
        QLineEdit *const name_edit = new QLineEdit(parent);
        name_edit->setText(_name);
+       name_edit->selectAll();
+       name_edit->setFocus();
        connect(name_edit, SIGNAL(textChanged(const QString&)),
                this, SLOT(on_text_changed(const QString&)));
        form->addRow(tr("Name"), name_edit);