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();
|
onGeometryChanged();
|
||||||
|
|
||||||
connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged);
|
connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged, Qt::QueuedConnection);
|
||||||
connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged);
|
connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged, Qt::QueuedConnection);
|
||||||
connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged);
|
connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect DesktopView::screenRect()
|
QRect DesktopView::screenRect()
|
||||||
|
@ -67,7 +67,6 @@ void DesktopView::onGeometryChanged()
|
||||||
{
|
{
|
||||||
m_screenRect = qApp->primaryScreen()->geometry();
|
m_screenRect = qApp->primaryScreen()->geometry();
|
||||||
setGeometry(qApp->primaryScreen()->geometry());
|
setGeometry(qApp->primaryScreen()->geometry());
|
||||||
|
|
||||||
emit screenRectChanged();
|
emit screenRectChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,7 @@ GridView {
|
||||||
if (control.ctrlPressed) {
|
if (control.ctrlPressed) {
|
||||||
dirModel.toggleSelected(hoveredItem.index)
|
dirModel.toggleSelected(hoveredItem.index)
|
||||||
} else {
|
} else {
|
||||||
|
dirModel.clearSelection()
|
||||||
dirModel.setSelected(hoveredItem.index)
|
dirModel.setSelected(hoveredItem.index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,8 +318,7 @@ GridView {
|
||||||
// 弹出文件夹菜单
|
// 弹出文件夹菜单
|
||||||
if (mouse.buttons & Qt.RightButton) {
|
if (mouse.buttons & Qt.RightButton) {
|
||||||
clearPressState()
|
clearPressState()
|
||||||
// dirModel.openContextMenu(null, mouse.modifiers)
|
dirModel.openContextMenu(null, mouse.modifiers)
|
||||||
folderMenu.open()
|
|
||||||
mouse.accepted = true
|
mouse.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,10 +211,12 @@ ListView {
|
||||||
dirModel.clearSelection()
|
dirModel.clearSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (control.ctrlPressed)
|
if (control.ctrlPressed) {
|
||||||
dirModel.toggleSelected(hoveredItem.index)
|
dirModel.toggleSelected(hoveredItem.index)
|
||||||
else
|
} else {
|
||||||
|
dirModel.clearSelection()
|
||||||
dirModel.setSelected(hoveredItem.index)
|
dirModel.setSelected(hoveredItem.index)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
control.currentIndex = hoveredItem.index
|
control.currentIndex = hoveredItem.index
|
||||||
|
|
Loading…
Reference in a new issue