Reduce the tap target of RoomTreeSection
For some reason I don't understand, the ItemDelegate used for these sections are ginormous. There is quite a bit of padding which confuses users as its unexpectedly used for the tap area. I changed it so we only listen for taps inside of the contentItem itself, which is a more suitable area.
This commit is contained in:
@@ -31,14 +31,21 @@ QQC2.ItemDelegate {
|
|||||||
activeFocusOnTab: false
|
activeFocusOnTab: false
|
||||||
background: null
|
background: null
|
||||||
|
|
||||||
onClicked: root.treeView.toggleExpanded(row)
|
|
||||||
|
|
||||||
Keys.onEnterPressed: root.treeView.toggleExpanded(row)
|
Keys.onEnterPressed: root.treeView.toggleExpanded(row)
|
||||||
Keys.onReturnPressed: root.treeView.toggleExpanded(row)
|
Keys.onReturnPressed: root.treeView.toggleExpanded(row)
|
||||||
Keys.onSpacePressed: root.treeView.toggleExpanded(row)
|
Keys.onSpacePressed: root.treeView.toggleExpanded(row)
|
||||||
|
|
||||||
contentItem: RowLayout {
|
contentItem: Item {
|
||||||
|
implicitWidth: layout.implicitWidth
|
||||||
|
implicitHeight: layout.implicitHeight
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: layout
|
||||||
|
|
||||||
|
width: root.contentItem.width
|
||||||
|
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
Kirigami.ListSectionHeader {
|
Kirigami.ListSectionHeader {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: !root.collapsed
|
visible: !root.collapsed
|
||||||
@@ -70,4 +77,10 @@ QQC2.ItemDelegate {
|
|||||||
onClicked: root.treeView.toggleExpanded(root.row)
|
onClicked: root.treeView.toggleExpanded(root.row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reduce the size of the tap target, this is smaller the ginormous section header ItemDelegate
|
||||||
|
TapHandler {
|
||||||
|
onTapped: root.treeView.toggleExpanded(root.row)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user