Dropdown/SearchableDropdown: arrow keys + row padding
This commit is contained in:
@@ -168,6 +168,7 @@ Item {
|
|||||||
id: optionList
|
id: optionList
|
||||||
spacing: 4
|
spacing: 4
|
||||||
|
|
||||||
|
Keys.priority: Keys.BeforeItem
|
||||||
Keys.onPressed: function(event) {
|
Keys.onPressed: function(event) {
|
||||||
if (event.key === Qt.Key_Escape) { popup.close(); event.accepted = true }
|
if (event.key === Qt.Key_Escape) { popup.close(); event.accepted = true }
|
||||||
else if (event.key === Qt.Key_Down || event.text === "j") {
|
else if (event.key === Qt.Key_Down || event.text === "j") {
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ Item {
|
|||||||
y: trigger.height + 2
|
y: trigger.height + 2
|
||||||
width: trigger.width
|
width: trigger.width
|
||||||
implicitHeight: Math.max(root.popupMinHeight,
|
implicitHeight: Math.max(root.popupMinHeight,
|
||||||
Math.min(root.filtered.length * root.popupRowHeight + Math.max(0, root.filtered.length - 1) * 4 + 50,
|
Math.min(resultList.contentHeight + 50,
|
||||||
root.popupRowHeight * 6 + 5 * 4 + 50))
|
root.popupRowHeight * 6 + 5 * 4 + 50))
|
||||||
padding: 1
|
padding: 1
|
||||||
focus: true
|
focus: true
|
||||||
@@ -267,6 +267,7 @@ Item {
|
|||||||
popup.close()
|
popup.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.priority: Keys.BeforeItem
|
||||||
Keys.onPressed: function(event) {
|
Keys.onPressed: function(event) {
|
||||||
if (event.key === Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
popup.close(); event.accepted = true
|
popup.close(); event.accepted = true
|
||||||
@@ -292,18 +293,19 @@ Item {
|
|||||||
required property var modelData
|
required property var modelData
|
||||||
required property int index
|
required property int index
|
||||||
width: resultList.width
|
width: resultList.width
|
||||||
height: root.popupRowHeight
|
height: Math.max(root.popupRowHeight, rowContent.implicitHeight + 12)
|
||||||
color: index === resultList.currentIndex
|
color: index === resultList.currentIndex
|
||||||
? Qt.rgba(root.foreground.r, root.foreground.g, root.foreground.b, 0.14)
|
? Qt.rgba(root.foreground.r, root.foreground.g, root.foreground.b, 0.14)
|
||||||
: "transparent"
|
: "transparent"
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
id: rowContent
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: 10
|
anchors.leftMargin: 10
|
||||||
anchors.rightMargin: 10
|
anchors.rightMargin: 10
|
||||||
spacing: 1
|
spacing: 2
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: root.optionLabel(modelData)
|
text: root.optionLabel(modelData)
|
||||||
|
|||||||
Reference in New Issue
Block a user