QVariant DecoderCollectionModel::headerData(int section, Qt::Orientation orientation,
int role) const
{
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
+ if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole))
return root_->data(section);
return QVariant();
QVariant AnnotationCollectionModel::data(const QModelIndex& index, int role) const
{
- if (!index.isValid() || !signal_)
+ if (!signal_ || !index.isValid() || !index.internalPointer())
return QVariant();
const Annotation* ann =
QVariant AnnotationCollectionModel::headerData(int section, Qt::Orientation orientation,
int role) const
{
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
+ if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole))
return header_data_.at(section);
return QVariant();
const QModelIndex& parent_idx) const
{
(void)parent_idx;
+ assert(row >= 0);
+ assert(column >= 0);
if (!all_annotations_)
return QModelIndex();
save_action_(new QAction(this)),
table_view_(new QCustomTableView()),
model_(new AnnotationCollectionModel()),
- signal_(nullptr),
- updating_data_(false)
+ signal_(nullptr)
{
QVBoxLayout *root_layout = new QVBoxLayout(this);
root_layout->setContentsMargins(0, 0, 0, 0);
void View::update_data()
{
- if (updating_data_) {
- if (!delayed_view_updater_.isActive())
- delayed_view_updater_.start();
- return;
- }
-
- updating_data_ = true;
-
- table_view_->setRootIndex(model_->index(1, 0, QModelIndex()));
model_->set_signal_and_segment(signal_, current_segment_);
-
- updating_data_ = false;
}
void View::save_data_as_csv(unsigned int save_type) const
data::DecodeSignal* signal_;
const data::decode::Decoder* decoder_;
- bool updating_data_;
};
} // namespace tabular_decoder