NComboBox: better sizing
This commit is contained in:
parent
e03042c411
commit
a68b3f49b0
2 changed files with 11 additions and 6 deletions
|
|
@ -8,8 +8,7 @@ import qs.Widgets
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property real preferredHeight: Style.baseWidgetSize * 1.1 * scaling
|
property real minimumWidth: 280 * scaling
|
||||||
property real preferredWidth: 320 * scaling
|
|
||||||
property real popupHeight: 180 * scaling
|
property real popupHeight: 180 * scaling
|
||||||
|
|
||||||
property string label: ""
|
property string label: ""
|
||||||
|
|
@ -20,9 +19,11 @@ RowLayout {
|
||||||
property string currentKey: ""
|
property string currentKey: ""
|
||||||
property string placeholder: ""
|
property string placeholder: ""
|
||||||
|
|
||||||
|
readonly property real preferredHeight: Style.baseWidgetSize * 1.1 * scaling
|
||||||
|
|
||||||
signal selected(string key)
|
signal selected(string key)
|
||||||
|
|
||||||
spacing: Style.marginS * scaling
|
spacing: Style.marginL * scaling
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
function findIndexByKey(key) {
|
function findIndexByKey(key) {
|
||||||
|
|
@ -39,11 +40,15 @@ RowLayout {
|
||||||
description: root.description
|
description: root.description
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: combo
|
id: combo
|
||||||
|
|
||||||
Layout.preferredWidth: root.preferredWidth
|
Layout.minimumWidth: root.minimumWidth
|
||||||
Layout.preferredHeight: height
|
Layout.preferredHeight: root.preferredHeight
|
||||||
model: model
|
model: model
|
||||||
currentIndex: findIndexByKey(currentKey)
|
currentIndex: findIndexByKey(currentKey)
|
||||||
onActivated: {
|
onActivated: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue