]> sigrok.org Git - pulseview.git/commitdiff
TabularDecView: Implement "focus on latest"
authorSoeren Apel <redacted>
Sun, 26 Apr 2020 13:26:59 +0000 (15:26 +0200)
committerUwe Hermann <redacted>
Sun, 3 May 2020 15:20:55 +0000 (17:20 +0200)
pv/views/tabular_decoder/model.cpp
pv/views/tabular_decoder/view.cpp
pv/views/tabular_decoder/view.hpp

index 1d4d839e4757be2ad20169c09b621f04044013b1..f80b0012657df46e7acf38a86610cc43d24cd326 100644 (file)
@@ -202,8 +202,7 @@ void AnnotationCollectionModel::set_signal_and_segment(data::DecodeSignal* signa
        } else {
                // Force the view associated with this model to update when we have more annotations
                if (prev_last_row_ < new_row_count) {
-                       dataChanged(index(prev_last_row_, 0, QModelIndex()),
-                               index(new_row_count, 0, QModelIndex()));
+                       dataChanged(index(prev_last_row_, 0), index(new_row_count, 0));
                        layoutChanged();
                }
        }
@@ -246,7 +245,7 @@ void AnnotationCollectionModel::update_annotations_without_hidden()
 
        all_annotations_without_hidden_.resize(count);
 
-       dataChanged(index(0, 0, QModelIndex()), index(count, 0, QModelIndex()));
+       dataChanged(index(0, 0), index(count, 0));
        layoutChanged();
 }
 
index 0a425e66188119de060ed662914f9a9da6fdb81f..6ee3e2ac13b1871b632bfa229c44ef0f4d4b4ca4 100644 (file)
@@ -58,8 +58,8 @@ const char* SaveTypeNames[SaveTypeCount] = {
 
 const char* ViewModeNames[ViewModeCount] = {
        "Show all",
-       "Show all and focus on newest",
-       "Show visible in main view"
+       "Show all and focus on newest"
+//     "Show visible in main view"
 };
 
 QSize QCustomTableView::minimumSizeHint() const
@@ -333,7 +333,7 @@ void View::save_data_as_csv(unsigned int save_type) const
                                if (table_view_->horizontalHeader()->isSectionHidden(column))
                                        continue;
 
-                               const QModelIndex idx = model_->index(row, column, QModelIndex());
+                               const QModelIndex idx = model_->index(row, column);
                                QString s = model_->data(idx, Qt::DisplayRole).toString();
 
                                if (save_type == SaveTypeCSVEscaped)
@@ -433,8 +433,14 @@ void View::on_signal_color_changed(const QColor &color)
 
 void View::on_new_annotations()
 {
-       if (!delayed_view_updater_.isActive())
-               delayed_view_updater_.start();
+       if (view_mode_selector_->currentIndex() == ViewModeLatest) {
+               update_data();
+               table_view_->scrollTo(model_->index(model_->rowCount() - 1, 0),
+                       QAbstractItemView::PositionAtBottom);
+       } else {
+               if (!delayed_view_updater_.isActive())
+                       delayed_view_updater_.start();
+       }
 }
 
 void View::on_decoder_reset()
index 999501a2541b90626f0758e37e17a9cec40ad72d..93761bda49bc15e56fadad2162bec7791aa55b13 100644 (file)
@@ -48,7 +48,7 @@ enum SaveType {
 enum ViewModeType {
        ViewModeAll,
        ViewModeLatest,
-       ViewModeVisible,
+//     ViewModeVisible,
        ViewModeCount // Indicates how many save types there are, must always be last
 };