A selection logic is improved
This commit is contained in:
parent
eb9085cc8e
commit
c061788e9c
4 changed files with 30 additions and 16 deletions
|
@ -297,9 +297,6 @@ GridView {
|
||||||
if (control.ctrlPressed) {
|
if (control.ctrlPressed) {
|
||||||
dirModel.toggleSelected(hoveredItem.index)
|
dirModel.toggleSelected(hoveredItem.index)
|
||||||
} else {
|
} else {
|
||||||
if (mouse.button == Qt.LeftButton)
|
|
||||||
dirModel.clearSelection()
|
|
||||||
|
|
||||||
dirModel.setSelected(hoveredItem.index)
|
dirModel.setSelected(hoveredItem.index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,7 +413,18 @@ GridView {
|
||||||
dirModel.openSelected()
|
dirModel.openSelected()
|
||||||
}
|
}
|
||||||
|
|
||||||
onReleased: pressCanceled()
|
onReleased: {
|
||||||
|
// 当选择多个文件的时候,在这选择里的文件中点击
|
||||||
|
if (pressedItem != null &&
|
||||||
|
!control.rubberBand &&
|
||||||
|
!dirModel.dragging) {
|
||||||
|
dirModel.clearSelection()
|
||||||
|
dirModel.setSelected(pressedItem.index)
|
||||||
|
}
|
||||||
|
|
||||||
|
pressCanceled()
|
||||||
|
}
|
||||||
|
|
||||||
onCanceled: pressCanceled()
|
onCanceled: pressCanceled()
|
||||||
|
|
||||||
onWheel: {
|
onWheel: {
|
||||||
|
|
|
@ -214,9 +214,6 @@ ListView {
|
||||||
if (control.ctrlPressed) {
|
if (control.ctrlPressed) {
|
||||||
dirModel.toggleSelected(hoveredItem.index)
|
dirModel.toggleSelected(hoveredItem.index)
|
||||||
} else {
|
} else {
|
||||||
if (mouse.button == Qt.LeftButton)
|
|
||||||
dirModel.clearSelection()
|
|
||||||
|
|
||||||
dirModel.setSelected(hoveredItem.index)
|
dirModel.setSelected(hoveredItem.index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -322,7 +319,17 @@ ListView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onReleased: pressCanceled()
|
onReleased: {
|
||||||
|
if (pressedItem != null &&
|
||||||
|
!control.rubberBand &&
|
||||||
|
!dirModel.dragging) {
|
||||||
|
dirModel.clearSelection()
|
||||||
|
dirModel.setSelected(pressedItem.index)
|
||||||
|
}
|
||||||
|
|
||||||
|
pressCanceled()
|
||||||
|
}
|
||||||
|
|
||||||
onCanceled: pressCanceled()
|
onCanceled: pressCanceled()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ ListView {
|
||||||
model: placesModel
|
model: placesModel
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
leftMargin: FishUI.Units.smallSpacing
|
leftMargin: FishUI.Units.smallSpacing * 1.5
|
||||||
rightMargin: FishUI.Units.smallSpacing
|
rightMargin: FishUI.Units.smallSpacing * 1.5
|
||||||
bottomMargin: FishUI.Units.smallSpacing
|
bottomMargin: FishUI.Units.smallSpacing
|
||||||
spacing: FishUI.Units.smallSpacing
|
spacing: FishUI.Units.smallSpacing
|
||||||
|
|
||||||
|
|
11
qml/main.qml
11
qml/main.qml
|
@ -15,7 +15,7 @@ FishUI.Window {
|
||||||
visible: true
|
visible: true
|
||||||
title: qsTr("File Manager")
|
title: qsTr("File Manager")
|
||||||
|
|
||||||
headerBarHeight: 35 + FishUI.Units.largeSpacing
|
headerBarHeight: 35 + FishUI.Units.smallSpacing * 3
|
||||||
backgroundColor: FishUI.Theme.secondBackgroundColor
|
backgroundColor: FishUI.Theme.secondBackgroundColor
|
||||||
|
|
||||||
property QtObject settings: GlobalSettings { }
|
property QtObject settings: GlobalSettings { }
|
||||||
|
@ -31,10 +31,10 @@ FishUI.Window {
|
||||||
headerBar: Item {
|
headerBar: Item {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.leftMargin: FishUI.Units.smallSpacing
|
anchors.leftMargin: FishUI.Units.smallSpacing * 1.5
|
||||||
anchors.rightMargin: FishUI.Units.smallSpacing
|
anchors.rightMargin: FishUI.Units.smallSpacing * 1.5
|
||||||
anchors.topMargin: FishUI.Units.smallSpacing
|
anchors.topMargin: FishUI.Units.smallSpacing * 1.5
|
||||||
anchors.bottomMargin: FishUI.Units.smallSpacing
|
anchors.bottomMargin: FishUI.Units.smallSpacing * 1.5
|
||||||
|
|
||||||
spacing: FishUI.Units.smallSpacing
|
spacing: FishUI.Units.smallSpacing
|
||||||
|
|
||||||
|
@ -80,7 +80,6 @@ FishUI.Window {
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: 2
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
SideBar {
|
SideBar {
|
||||||
|
|
Loading…
Reference in a new issue