mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
fixed selection issues in grid view
This commit is contained in:
parent
280c6b96e9
commit
1a04358a83
@ -102,6 +102,8 @@ void GridComicsView::setModel(ComicModel *model)
|
||||
void GridComicsView::setCurrentIndex(const QModelIndex &index)
|
||||
{
|
||||
QLOG_INFO() << "setCurrentIndex";
|
||||
_selectionModel->select(index, QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
view->rootContext()->setContextProperty("dummyValue", true);
|
||||
}
|
||||
|
||||
QModelIndex GridComicsView::currentIndex()
|
||||
@ -153,6 +155,11 @@ void GridComicsView::enableFilterMode(bool enabled)
|
||||
void GridComicsView::selectAll()
|
||||
{
|
||||
QLOG_INFO() << "selectAll";
|
||||
QModelIndex top = model->index(0, 0);
|
||||
QModelIndex bottom = model->index(model->rowCount()-1, 0);
|
||||
QItemSelection selection(top, bottom);
|
||||
_selectionModel->select(selection, QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
view->rootContext()->setContextProperty("dummyValue", true);
|
||||
}
|
||||
|
||||
void GridComicsView::rate(int index, int rating)
|
||||
|
@ -12,7 +12,7 @@ Rectangle {
|
||||
|
||||
function selectAll(from,to)
|
||||
{
|
||||
for(var i = from+1;i<to;i++)
|
||||
for(var i = from;i<to;i++)
|
||||
{
|
||||
comicsSelectionHelper.selectIndex(i);
|
||||
}
|
||||
@ -120,6 +120,14 @@ Rectangle {
|
||||
|
||||
}
|
||||
|
||||
onReleased: {
|
||||
if(mouse.button != Qt.RightButton && !(mouse.modifiers & Qt.ControlModifier || mouse.modifiers & Qt.ShiftModifier))
|
||||
{
|
||||
comicsSelectionHelper.clear();
|
||||
grid.currentIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user