Fix NWidgetCard

This commit is contained in:
LemmyCook 2025-08-22 17:57:55 -04:00
parent 017813ab57
commit 2a6ad0819f
7 changed files with 34 additions and 37 deletions

View file

@ -15,7 +15,7 @@ ColumnLayout {
property ListModel model: {
}
property string currentKey: ''
property string currentKey: ""
property string placeholder: ""
signal selected(string key)

View file

@ -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 = ""
}
}
}