20 #include <QApplication> 31 using std::make_shared;
40 namespace tabular_decoder {
44 all_annotations_(nullptr),
47 first_hidden_column_(0),
50 had_highlight_before_(false),
80 case 0:
return QVariant((qulonglong)ann->
start_sample());
95 case 6:
return QVariant((qulonglong)ann->
end_sample());
96 default:
return QVariant();
102 if (!
signal_ || !index.isValid() || !index.internalPointer())
106 static_cast<const Annotation*
>(index.internalPointer());
108 if ((role == Qt::DisplayRole) || (role == Qt::ToolTipRole))
111 if (role == Qt::ForegroundRole) {
118 if (must_highlight) {
120 return QApplication::palette().brush(QPalette::Window);
122 return QApplication::palette().brush(QPalette::WindowText);
126 return QApplication::palette().brush(QPalette::WindowText);
129 if (role == Qt::BackgroundRole) {
139 color = ann->
color();
144 return QBrush(color);
153 if (!index.isValid())
154 return Qt::NoItemFlags;
156 return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemNeverHasChildren;
167 if ((section < 0) || (section >= (
int)
header_data_.size()))
170 if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole))
177 const QModelIndex& parent_idx)
const 183 return QModelIndex();
187 if ((
size_t)row < dataset_->size())
188 idx = createIndex(row, column, (
void*)
dataset_->at(row));
197 return QModelIndex();
219 layoutAboutToBeChanged();
226 dataChanged(QModelIndex(), QModelIndex());
239 connect(dec.get(), SIGNAL(annotation_visibility_changed()),
253 const size_t new_row_count =
dataset_->size() - 1;
257 dataChanged(
index(0, 0),
index(new_row_count, 0));
273 layoutAboutToBeChanged();
288 dataChanged(QModelIndex(), QModelIndex());
316 QModelIndex last, int64_t sample_num)
318 bool has_highlight =
false;
326 if (sample_num >= 0) {
327 last = last.sibling(last.row() + 1, 0);
331 QModelIndex
index = first;
340 has_highlight =
true;
344 index = index.sibling(index.row() + 1, 0);
345 }
while (index != last);
349 dataChanged(first, last);
361 layoutAboutToBeChanged();
368 dataChanged(QModelIndex(), QModelIndex());
QModelIndex index(int row, int column, const QModelIndex &parent_idx=QModelIndex()) const override
data::DecodeSignal * signal_
const vector< shared_ptr< Decoder > > & decoder_stack() const
QVariant data(const QModelIndex &index, int role) const override
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t t(t+t)") define_sfop3(16
QModelIndex parent(const QModelIndex &index) const override
QString format_time_si(const Timestamp &v, SIPrefix prefix, unsigned int precision, QString unit, bool sign)
const deque< const Annotation * > * all_annotations_
int get_hierarchy_level(const Annotation *ann) const
const QColor bright_color() const
const QColor color() const
Qt::ItemFlags flags(const QModelIndex &index) const override
uint64_t start_sample() const
uint64_t end_sample() const
void set_hide_hidden(bool hide_hidden)
const char * name() const
uint8_t first_hidden_column_
void on_annotation_visibility_changed()
static bool current_theme_is_dark()
const deque< const Annotation * > * get_all_annotations_by_segment(uint32_t segment_id) const
const QString ann_class_description() const
QModelIndex update_highlighted_rows(QModelIndex first, QModelIndex last, int64_t sample_num)
virtual double get_samplerate() const
uint8_t first_hidden_column() const
int rowCount(const QModelIndex &parent_idx=QModelIndex()) const override
const QString description() const
const Decoder * decoder() const
int columnCount(const QModelIndex &parent_idx=QModelIndex()) const override
QString format_time_minutes(const Timestamp &t, signed precision, bool sign)
bool had_highlight_before_
void set_signal_and_segment(data::DecodeSignal *signal, uint32_t current_segment)
deque< const Annotation * > all_annotations_without_hidden_
const RowData * row_data() const
vector< QVariant > header_data_
AnnotationCollectionModel(QObject *parent=nullptr)
int64_t highlight_sample_num_
boost::multiprecision::number< boost::multiprecision::cpp_dec_float< 24 >, boost::multiprecision::et_off > Timestamp
Timestamp type providing yoctosecond resolution.
const QColor dark_color() const
uint8_t get_stack_level() const
const QString longest_annotation() const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
QVariant data_from_ann(const Annotation *ann, int index) const
void update_annotations_without_hidden()
const deque< const Annotation * > * dataset_