Fix Dropdown/SearchableDropdown integration issues
This commit is contained in:
@@ -136,23 +136,26 @@ Item {
|
|||||||
radius: Style.cornerRadius
|
radius: Style.cornerRadius
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpened: optionList.currentIndex = Math.max(0, optionList.indexOfValue(root.value))
|
onOpened: {
|
||||||
|
optionList.currentIndex = Math.max(0, optionList.indexOfValue(root.value))
|
||||||
Keys.onPressed: function(event) {
|
optionList.forceActiveFocus()
|
||||||
if (event.key === Qt.Key_Escape) { popup.close(); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Down || event.text === "j") {
|
|
||||||
optionList.currentIndex = Math.min(root.options.length - 1, optionList.currentIndex + 1)
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_Up || event.text === "k") {
|
|
||||||
optionList.currentIndex = Math.max(0, optionList.currentIndex - 1)
|
|
||||||
event.accepted = true
|
|
||||||
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
|
||||||
optionList.selectCurrent(); event.accepted = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: ListView {
|
contentItem: ListView {
|
||||||
id: optionList
|
id: optionList
|
||||||
|
|
||||||
|
Keys.onPressed: function(event) {
|
||||||
|
if (event.key === Qt.Key_Escape) { popup.close(); event.accepted = true }
|
||||||
|
else if (event.key === Qt.Key_Down || event.text === "j") {
|
||||||
|
optionList.currentIndex = Math.min(root.options.length - 1, optionList.currentIndex + 1)
|
||||||
|
event.accepted = true
|
||||||
|
} else if (event.key === Qt.Key_Up || event.text === "k") {
|
||||||
|
optionList.currentIndex = Math.max(0, optionList.currentIndex - 1)
|
||||||
|
event.accepted = true
|
||||||
|
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||||
|
optionList.selectCurrent(); event.accepted = true
|
||||||
|
}
|
||||||
|
}
|
||||||
implicitHeight: contentHeight
|
implicitHeight: contentHeight
|
||||||
clip: true
|
clip: true
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls as QQC
|
||||||
import qs.Commons
|
import qs.Commons
|
||||||
|
|
||||||
// Searchable single-select dropdown. Same trigger shape as Dropdown, but
|
// Searchable single-select dropdown. Same trigger shape as Dropdown, but
|
||||||
@@ -140,7 +140,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Popup {
|
QQC.Popup {
|
||||||
id: popup
|
id: popup
|
||||||
x: 0
|
x: 0
|
||||||
y: trigger.height + 2
|
y: trigger.height + 2
|
||||||
|
|||||||
@@ -787,7 +787,6 @@ Item {
|
|||||||
}
|
}
|
||||||
foreground: root.foreground
|
foreground: root.foreground
|
||||||
accent: root.accent
|
accent: root.accent
|
||||||
cornerRadius: root.cornerRadius
|
|
||||||
fontFamily: root.fontFamily
|
fontFamily: root.fontFamily
|
||||||
onChanged: function(v) { if (v) root.addEntry(section.sectionKey, v) }
|
onChanged: function(v) { if (v) root.addEntry(section.sectionKey, v) }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user