Generic auto-focusing for first line edit of popup
[pulseview.git] / pv / view / signal.cpp
index 97e05494cca05eac922a47a6bb0c1dd878472d93..7df31767ea5492659dcc8e1e33ef5b0a17c9cb4c 100644 (file)
@@ -112,15 +112,9 @@ void Signal::populate_popup_form(QWidget *parent, QFormLayout *form)
                _name_widget->setCurrentIndex(index);
        }
 
-       _name_widget->lineEdit()->selectAll();
-       _name_widget->setFocus();
-
        connect(_name_widget, SIGNAL(editTextChanged(const QString&)),
                this, SLOT(on_text_changed(const QString&)));
 
-       // We want to close the popup when the Enter key was pressed.
-       _name_widget->installEventFilter(this);
-
        form->addRow(tr("Name"), _name_widget);
 
        add_colour_option(parent, form);
@@ -140,24 +134,6 @@ QMenu* Signal::create_context_menu(QWidget *parent)
        return menu;
 }
 
-bool Signal::eventFilter(QObject *obj, QEvent *evt)
-{
-       QKeyEvent *keyEvent;
-
-       (void)obj;
-
-       if (evt->type() == QEvent::KeyPress) {
-               keyEvent = static_cast<QKeyEvent*>(evt);
-               if (keyEvent->key() == Qt::Key_Enter ||
-                   keyEvent->key() == Qt::Key_Return) {
-                       close_popup();
-                       return true;
-               }
-       }
-
-       return false;
-}
-
 void Signal::delete_pressed()
 {
        on_disable();