]> sigrok.org Git - pulseview.git/blobdiff - pv/views/tabular_decoder/view.cpp
Implement MathSignal
[pulseview.git] / pv / views / tabular_decoder / view.cpp
index 4715b4a90b5070444238779e682f42a4dc98eb7e..0aca4790e8ecc6d984df00129811a1a82fae7077 100644 (file)
@@ -139,6 +139,14 @@ QSize CustomTableView::sizeHint() const
        return minimumSizeHint();
 }
 
+void CustomTableView::keyPressEvent(QKeyEvent *event)
+{
+       if ((event->key() == Qt::Key_Return) || (event->key() == Qt::Key_Enter))
+               activatedByKey(currentIndex());
+       else
+               QTableView::keyPressEvent(event);
+}
+
 
 View::View(Session &session, bool is_main_view, QMainWindow *parent) :
        ViewBase(session, is_main_view, parent),
@@ -239,6 +247,8 @@ View::View(Session &session, bool is_main_view, QMainWindow *parent) :
                this, SLOT(on_table_item_clicked(const QModelIndex&)));
        connect(table_view_, SIGNAL(doubleClicked(const QModelIndex&)),
                this, SLOT(on_table_item_double_clicked(const QModelIndex&)));
+       connect(table_view_, SIGNAL(activatedByKey(const QModelIndex&)),
+               this, SLOT(on_table_item_double_clicked(const QModelIndex&)));
        connect(table_view_->horizontalHeader(), SIGNAL(customContextMenuRequested(const QPoint&)),
                this, SLOT(on_table_header_requested(const QPoint&)));
 
@@ -460,6 +470,9 @@ void View::on_selected_decoder_changed(int index)
        }
 
        update_data();
+
+       // Force repaint, otherwise the new selection isn't shown for some reason
+       table_view_->viewport()->update();
 }
 
 void View::on_hide_hidden_changed(bool checked)
@@ -522,7 +535,8 @@ void View::on_signal_color_changed(const QColor &color)
 {
        (void)color;
 
-       table_view_->update();
+       // Force immediate repaint, otherwise it's updated after the header popup is closed
+       table_view_->viewport()->update();
 }
 
 void View::on_new_annotations()