mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 05:24:57 -04:00
Check model rowCount before accessing to data.
This commit is contained in:
@ -194,7 +194,7 @@ void GridComicsView::updateBackgroundConfig()
|
|||||||
//backgroun image configuration
|
//backgroun image configuration
|
||||||
bool useBackgroundImage = settings->value(USE_BACKGROUND_IMAGE_IN_GRID_VIEW, true).toBool();
|
bool useBackgroundImage = settings->value(USE_BACKGROUND_IMAGE_IN_GRID_VIEW, true).toBool();
|
||||||
|
|
||||||
if(useBackgroundImage)
|
if(useBackgroundImage && this->model->rowCount() > 0)
|
||||||
{
|
{
|
||||||
float opacity = settings->value(OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW, 0.2).toFloat();
|
float opacity = settings->value(OPACITY_BACKGROUND_IMAGE_IN_GRID_VIEW, 0.2).toFloat();
|
||||||
float blurRadius = settings->value(BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW, 75).toInt();
|
float blurRadius = settings->value(BLUR_RADIUS_BACKGROUND_IMAGE_IN_GRID_VIEW, 75).toInt();
|
||||||
|
@ -67,7 +67,10 @@ void InfoComicsView::setModel(ComicModel *model)
|
|||||||
_selectionModel = new QItemSelectionModel(model);*/
|
_selectionModel = new QItemSelectionModel(model);*/
|
||||||
|
|
||||||
ctxt->setContextProperty("comicsList", model);
|
ctxt->setContextProperty("comicsList", model);
|
||||||
|
if(model->rowCount()>0)
|
||||||
ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(0, 0), ComicModel::CoverPathRole));
|
ctxt->setContextProperty("backgroundImage", this->model->data(this->model->index(0, 0), ComicModel::CoverPathRole));
|
||||||
|
else
|
||||||
|
ctxt->setContextProperty("backgroundImage", QUrl());
|
||||||
|
|
||||||
/*ctxt->setContextProperty("comicsSelection", _selectionModel);
|
/*ctxt->setContextProperty("comicsSelection", _selectionModel);
|
||||||
ctxt->setContextProperty("contextMenuHelper",this);
|
ctxt->setContextProperty("contextMenuHelper",this);
|
||||||
|
Reference in New Issue
Block a user