mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
fixed bug grid view when the current index is requested, if there are no comics then a invalid QModelIndex should be returned
This commit is contained in:
parent
1a8b629e71
commit
135f2432f1
@ -219,13 +219,21 @@ void GridComicsView::setCurrentIndex(const QModelIndex &index)
|
||||
|
||||
QModelIndex GridComicsView::currentIndex()
|
||||
{
|
||||
QLOG_INFO() << "currentIndex";
|
||||
QLOG_INFO() << "currentIndex";
|
||||
|
||||
if(!_selectionModel)
|
||||
return QModelIndex();
|
||||
|
||||
QModelIndexList indexes = _selectionModel->selectedRows();
|
||||
if(indexes.length()>0)
|
||||
return indexes[0];
|
||||
|
||||
this->selectIndex(0);
|
||||
return _selectionModel->selectedRows()[0];
|
||||
indexes = _selectionModel->selectedRows();
|
||||
if(indexes.length()>0)
|
||||
return indexes[0];
|
||||
else
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QItemSelectionModel *GridComicsView::selectionModel()
|
||||
|
Loading…
Reference in New Issue
Block a user