DemoPanel tweaks

This commit is contained in:
quadbyte 2025-08-12 23:20:31 -04:00
parent d06679aad6
commit 25c9217b6b
3 changed files with 134 additions and 135 deletions

View file

@ -36,164 +36,164 @@ NLoader {
anchors.fill: parent anchors.fill: parent
} }
// Debug: Add a simple text to see if content is visible
NText {
text: "DemoPanel is working!"
color: Colors.accentPrimary
font.pointSize: Style.fontSizeLarge * scaling
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 20 * scaling
}
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
anchors.margins: Style.marginMedium * scaling anchors.margins: Style.marginXL * scaling
anchors.topMargin: (Style.marginMedium + 40) * scaling
spacing: Style.marginMedium * scaling NText {
text: "DemoPanel"
color: Colors.accentPrimary
font.pointSize: Style.fontSizeXL* scaling
font.weight: Style.fontWeightBold
Layout.alignment: Qt.AlignHCenter
}
// NSlider
ColumnLayout { ColumnLayout {
spacing: 16 * scaling
NText { spacing: Style.marginMedium * scaling
text: "Scaling"
color: Colors.accentSecondary // NSlider
font.weight: Style.fontWeightBold ColumnLayout {
} spacing: 16 * scaling
RowLayout { NText {
spacing: Style.marginSmall * scaling text: "Scaling"
NSlider { color: Colors.accentSecondary
label: "Scaling" font.weight: Style.fontWeightBold
description: "Scaling goes brrrr" }
valueSuffix: "%" RowLayout {
from: 60 spacing: Style.marginSmall * scaling
to: 180 NSlider {
stepSize: 1 label: "Scaling"
value: Scaling.overrideScale * 100 description: "Scaling goes brrrr"
implicitWidth: bgRect.width * 0.75 valueSuffix: "%"
onPressedChanged: function (pressed, value) { from: 60
Scaling.overrideEnabled = true to: 180
Scaling.overrideScale = value / 100 stepSize: 1
value: Scaling.overrideScale * 100
implicitWidth: bgRect.width * 0.75
onPressedChanged: function (pressed, value) {
Scaling.overrideEnabled = true
Scaling.overrideScale = value / 100
}
}
NIconButton {
icon: "refresh"
fontPointSize: Style.fontSizeLarge * scaling
onClicked: {
Scaling.overrideEnabled = false
Scaling.overrideScale = 1.0
}
} }
} }
NDivider {
Layout.fillWidth: true
}
}
// NIconButton
ColumnLayout {
spacing: 16 * scaling
NText {
text: "NIconButton"
color: Colors.accentSecondary
font.weight: Style.fontWeightBold
}
NIconButton { NIconButton {
icon: "refresh" id: myIconButton
fontPointSize: Style.fontSizeXL * scaling icon: "celebration"
onClicked: { fontPointSize: Style.fontSizeLarge * scaling
Scaling.overrideEnabled = false }
Scaling.overrideScale = 1.0
console.log("Reset!") NDivider {
Layout.fillWidth: true
}
}
// NToggle
ColumnLayout {
spacing: Style.marginMedium * scaling
NText {
text: "NToggle"
color: Colors.accentSecondary
font.weight: Style.fontWeightBold
}
NToggle {
label: "Label"
description: "Description"
onToggled: function (value) {
console.log("[DemoPanel] NToggle:", value)
} }
} }
}
NDivider {
Layout.fillWidth: true
}
}
// NIconButton NDivider {
ColumnLayout { Layout.fillWidth: true
spacing: 16 * scaling
NText {
text: "NIconButton"
color: Colors.accentSecondary
font.weight: Style.fontWeightBold
}
NIconButton {
id: myIconButton
icon: "celebration"
fontPointSize: Style.fontSizeXL * scaling
}
NDivider {
Layout.fillWidth: true
}
}
// NToggle
ColumnLayout {
spacing: Style.marginMedium * scaling
NText {
text: "NToggle"
color: Colors.accentSecondary
font.weight: Style.fontWeightBold
}
NToggle {
label: "Label"
description: "Description"
onToggled: function (value) {
console.log("[DemoPanel] NToggle:", value)
} }
} }
NDivider { // NComboBox
Layout.fillWidth: true ColumnLayout {
} spacing: Style.marginMedium * scaling
} NText {
text: "NComboBox"
color: Colors.accentSecondary
font.weight: Style.fontWeightBold
}
// NComboBox NComboBox {
ColumnLayout { label: "Animal"
spacing: Style.marginMedium * scaling description: "What's your favorite"
NText { optionsKeys: ["cat", "dog", "bird", "monkey", "fish", "turtle", "elephant", "tiger"]
text: "NComboBox" optionsLabels: ["Cat", "Dog", "Bird", "Monkey", "Fish", "Turtle", "Elephant", "Tiger"]
color: Colors.accentSecondary currentKey: "cat"
font.weight: Style.fontWeightBold onSelected: function (value) {
} console.log("[DemoPanel] NComboBox: selected ", value)
}
}
NComboBox { NDivider {
label: "Animal" Layout.fillWidth: true
description: "What's your favorite"
optionsKeys: ["cat", "dog", "bird", "monkey", "fish", "turtle", "elephant", "tiger"]
optionsLabels: ["Cat", "Dog", "Bird", "Monkey", "Fish", "Turtle", "Elephant", "Tiger"]
currentKey: "cat"
onSelected: function (value) {
console.log("[DemoPanel] NComboBox: selected ", value)
} }
} }
NDivider { // NTextInput
Layout.fillWidth: true ColumnLayout {
} spacing: Style.marginMedium * scaling
} NText {
text: "NTextInput"
color: Colors.accentSecondary
font.weight: Style.fontWeightBold
}
// NTextInput NTextInput {
ColumnLayout { label: "Input label"
spacing: Style.marginMedium * scaling description: "A cool description"
NText { text: "Type anything"
text: "NTextInput" Layout.fillWidth: true
color: Colors.accentSecondary onEditingFinished: {
font.weight: Style.fontWeightBold
}
NTextInput {
label: "Input label"
description: "A cool description"
text: "Type anything"
Layout.fillWidth: true
onEditingFinished: {
}
}
NDivider {
Layout.fillWidth: true
} }
} }
NDivider {
Layout.fillWidth: true
}
}
// NBusyIndicator // NBusyIndicator
ColumnLayout { ColumnLayout {
spacing: Style.marginMedium * scaling spacing: Style.marginMedium * scaling
NText { NText {
text: "NBusyIndicator" text: "NBusyIndicator"
color: Colors.accentSecondary color: Colors.accentSecondary
font.weight: Style.fontWeightBold font.weight: Style.fontWeightBold
} }
NBusyIndicator {} NBusyIndicator {}
NDivider { NDivider {
Layout.fillWidth: true Layout.fillWidth: true
}
} }
} }
} }

View file

@ -58,7 +58,7 @@ Singleton {
property int marginSmall: 8 property int marginSmall: 8
property int marginMedium: 12 property int marginMedium: 12
property int marginLarge: 16 property int marginLarge: 16
property int marginExtraLarge: 20 property int marginXL: 24
// Opacity // Opacity
property real opacityNone: 0.0 property real opacityNone: 0.0

View file

@ -72,7 +72,6 @@ ColumnLayout {
font.weight: Style.fontWeightBold font.weight: Style.fontWeightBold
color: Colors.textPrimary color: Colors.textPrimary
Layout.alignment: Qt.AlignBottom | Qt.AlignRight Layout.alignment: Qt.AlignBottom | Qt.AlignRight
} }
} }