Fix NWidgetCard
This commit is contained in:
parent
017813ab57
commit
2a6ad0819f
7 changed files with 34 additions and 37 deletions
|
|
@ -15,7 +15,7 @@ ColumnLayout {
|
|||
property ListModel model: {
|
||||
|
||||
}
|
||||
property string currentKey: ''
|
||||
property string currentKey: ""
|
||||
property string placeholder: ""
|
||||
|
||||
signal selected(string key)
|
||||
|
|
|
|||
|
|
@ -58,23 +58,24 @@ NCard {
|
|||
description: ""
|
||||
placeholder: "Add widget to " + sectionName.toLowerCase() + " section"
|
||||
onSelected: key => {
|
||||
comboBox.selectedKey = key
|
||||
comboBox.currentKey = key
|
||||
}
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
icon: "add"
|
||||
size: 24 * scaling
|
||||
|
||||
colorBg: Color.mPrimary
|
||||
colorFg: Color.mOnPrimary
|
||||
colorBgHover: Color.mPrimaryContainer
|
||||
colorFgHover: Color.mOnPrimaryContainer
|
||||
colorBgHover: Color.mSecondary
|
||||
colorFgHover: Color.mOnSecondary
|
||||
enabled: comboBox.selectedKey !== ""
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onClicked: {
|
||||
if (comboBox.selectedKey !== "") {
|
||||
addWidget(comboBox.selectedKey, sectionName.toLowerCase())
|
||||
comboBox.reset()
|
||||
if (comboBox.currentKey !== "") {
|
||||
addWidget(comboBox.currentKey, sectionName.toLowerCase())
|
||||
comboBox.currentKey = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue