uint64_t start_sample() const;
uint64_t end_sample() const;
+ uint64_t length() const;
Class ann_class_id() const;
const QString ann_class_name() const;
it--;
ann_has_earlier_start = (pdata->start_sample < (*it)->start_sample());
ann_has_same_start = (pdata->start_sample == (*it)->start_sample());
- ann_is_longer = (new_ann_len > ((*it)->end_sample() - (*it)->start_sample()));
+ ann_is_longer = (new_ann_len > (*it)->length());
} while ((ann_has_earlier_start || (ann_has_same_start && ann_is_longer)) && (it != all_annotations.begin()));
// Allow inserting at the front
#include "pv/views/tabular_decoder/view.hpp"
+#include "view.hpp"
+
using std::make_shared;
namespace pv {
AnnotationCollectionModel::AnnotationCollectionModel(QObject* parent) :
QAbstractTableModel(parent),
all_annotations_(nullptr),
+ signal_(nullptr),
prev_segment_(0),
prev_last_row_(0)
{
QVariant AnnotationCollectionModel::data(const QModelIndex& index, int role) const
{
- if (!index.isValid())
+ if (!index.isValid() || !signal_)
return QVariant();
const Annotation* ann =
}
if (role == Qt::BackgroundRole) {
- if (theme_is_dark_)
- return QBrush(ann->dark_color());
- else
- return QBrush(ann->bright_color());
+ int level = 0;
+
+ const unsigned int ann_stack_level = ann->row_data()->row()->decoder()->get_stack_level();
+ level = (signal_->decoder_stack().size() - 1 - ann_stack_level);
+
+ // Only use custom cell background color if column index reached the hierarchy level
+ if (index.column() >= level) {
+ if (theme_is_dark_)
+ return QBrush(ann->dark_color());
+ else
+ return QBrush(ann->bright_color());
+ }
}
return QVariant();
{
if (!signal) {
all_annotations_ = nullptr;
+ signal_ = nullptr;
dataChanged(QModelIndex(), QModelIndex());
layoutChanged();
return;
}
all_annotations_ = signal->get_all_annotations_by_segment(current_segment);
+ signal_ = signal;
if (!all_annotations_ || all_annotations_->empty()) {
prev_segment_ = current_segment;