Improve select item logic
This commit is contained in:
parent
3c0d077970
commit
9b838e58a9
3 changed files with 9 additions and 8 deletions
|
@ -48,9 +48,9 @@ DesktopView::DesktopView(QQuickView *parent)
|
|||
|
||||
onGeometryChanged();
|
||||
|
||||
connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged);
|
||||
connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged);
|
||||
connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged);
|
||||
connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged, Qt::QueuedConnection);
|
||||
connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged, Qt::QueuedConnection);
|
||||
connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QRect DesktopView::screenRect()
|
||||
|
@ -67,7 +67,6 @@ void DesktopView::onGeometryChanged()
|
|||
{
|
||||
m_screenRect = qApp->primaryScreen()->geometry();
|
||||
setGeometry(qApp->primaryScreen()->geometry());
|
||||
|
||||
emit screenRectChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -297,6 +297,7 @@ GridView {
|
|||
if (control.ctrlPressed) {
|
||||
dirModel.toggleSelected(hoveredItem.index)
|
||||
} else {
|
||||
dirModel.clearSelection()
|
||||
dirModel.setSelected(hoveredItem.index)
|
||||
}
|
||||
}
|
||||
|
@ -317,8 +318,7 @@ GridView {
|
|||
// 弹出文件夹菜单
|
||||
if (mouse.buttons & Qt.RightButton) {
|
||||
clearPressState()
|
||||
// dirModel.openContextMenu(null, mouse.modifiers)
|
||||
folderMenu.open()
|
||||
dirModel.openContextMenu(null, mouse.modifiers)
|
||||
mouse.accepted = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,11 +211,13 @@ ListView {
|
|||
dirModel.clearSelection()
|
||||
}
|
||||
|
||||
if (control.ctrlPressed)
|
||||
if (control.ctrlPressed) {
|
||||
dirModel.toggleSelected(hoveredItem.index)
|
||||
else
|
||||
} else {
|
||||
dirModel.clearSelection()
|
||||
dirModel.setSelected(hoveredItem.index)
|
||||
}
|
||||
}
|
||||
|
||||
control.currentIndex = hoveredItem.index
|
||||
|
||||
|
|
Loading…
Reference in a new issue