better approach to avoid comic model problems after switching views

This commit is contained in:
Luis Ángel San Martín
2016-04-10 22:51:20 +02:00
parent ea4b9a69d4
commit 7ed4c27c01
3 changed files with 10 additions and 8 deletions

View File

@ -47,6 +47,8 @@ void InfoComicsView::setToolBar(QToolBar *toolBar)
void InfoComicsView::setModel(ComicModel *model)
{
BOOL setModel = model != this->model;
if(model == NULL)
return;
@ -62,7 +64,9 @@ void InfoComicsView::setModel(ComicModel *model)
//TODO fix crash in the following line on comics views switch
int row = currentIndex().row();
ctxt->setContextProperty("comicsList", model);
if(setModel)
ctxt->setContextProperty("comicsList", model);
ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(0, 0), ComicModel::CoverPathRole));
/*ctxt->setContextProperty("comicsSelection", _selectionModel);