diff --git a/modules/gui/src/sequence/sequence_model.cc b/modules/gui/src/sequence/sequence_model.cc index f4c8c65e117b0ab6e68d533df3a5e1dfdb164629..923a24c0fc2bb2adac5bb72b0be5bf5f21f0862f 100644 --- a/modules/gui/src/sequence/sequence_model.cc +++ b/modules/gui/src/sequence/sequence_model.cc @@ -40,10 +40,10 @@ SequenceModel::SequenceModel(QObject *parent) { this->beginInsertRows(QModelIndex(),this->rowCount(),this->rowCount()); BaseViewObject* title = new BaseViewObject(this); - TitleRow* title_row = new TitleRow(this); - Painter* p = new BackgroundPainter(this); + TitleRow* title_row = new TitleRow(title); + Painter* p = new BackgroundPainter(title_row); title_row->InsertPainter(p); - p = new TickPainter(this); + p = new TickPainter(title_row); title_row->InsertPainter(p); title->InsertRow(0,title_row); objects_.append(title); diff --git a/modules/gui/src/sequence/title_row.cc b/modules/gui/src/sequence/title_row.cc index 39013b3d7fda9a5df35d377ed3411220c24e2800..727aa0239b86a8e3eff2bba67e326efb0f3ea428 100644 --- a/modules/gui/src/sequence/title_row.cc +++ b/modules/gui/src/sequence/title_row.cc @@ -77,10 +77,11 @@ Qt::ItemFlags TitleRow::Flags(int column) const void TitleRow::DoubleClicked(int column) { if(this->parent()){ - SequenceModel* model = qobject_cast<SequenceModel*>(this->parent()->parent()); - int rows = model->rowCount()-1; - QItemSelection add = QItemSelection(model->index(1,column),model->index(rows,column)); - model->SelectionChanged(add,QItemSelection()); + if(SequenceModel* model = qobject_cast<SequenceModel*>(this->parent()->parent())){ + int rows = model->rowCount()-1; + QItemSelection add = QItemSelection(model->index(1,column),model->index(rows,column)); + model->SelectionChanged(add,QItemSelection()); + } } }