Generic auto-focusing for first line edit of popup
[pulseview.git] / pv / view / trace.cpp
index 250376ebb8828d931300a8a1a9ba5fc96ca4b749..f23de2ff50b33cb2771468584b8b4c5051bf3fab 100644 (file)
@@ -219,24 +219,6 @@ QRectF Trace::get_label_rect(int right)
                label_size.width(), label_size.height());
 }
 
-bool Trace::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;
-}
-
 QColor Trace::get_text_colour() const
 {
        return (_colour.lightness() > 64) ? Qt::black : Qt::white;
@@ -282,23 +264,13 @@ 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);
 
-       // We want to close the popup when the Enter key was pressed.
-       name_edit->installEventFilter(this);
-
        add_colour_option(parent, form);
 }
 
-void Trace::close_popup()
-{
-       _popup->close();
-}
-
 void Trace::on_popup_closed()
 {
        _popup = NULL;