mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -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()
|
QModelIndex GridComicsView::currentIndex()
|
||||||
{
|
{
|
||||||
QLOG_INFO() << "currentIndex";
|
QLOG_INFO() << "currentIndex";
|
||||||
|
|
||||||
|
if(!_selectionModel)
|
||||||
|
return QModelIndex();
|
||||||
|
|
||||||
QModelIndexList indexes = _selectionModel->selectedRows();
|
QModelIndexList indexes = _selectionModel->selectedRows();
|
||||||
if(indexes.length()>0)
|
if(indexes.length()>0)
|
||||||
return indexes[0];
|
return indexes[0];
|
||||||
|
|
||||||
this->selectIndex(0);
|
this->selectIndex(0);
|
||||||
return _selectionModel->selectedRows()[0];
|
indexes = _selectionModel->selectedRows();
|
||||||
|
if(indexes.length()>0)
|
||||||
|
return indexes[0];
|
||||||
|
else
|
||||||
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
QItemSelectionModel *GridComicsView::selectionModel()
|
QItemSelectionModel *GridComicsView::selectionModel()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user