DemoPanel improved layout

This commit is contained in:
quadbyte 2025-08-09 18:36:48 -04:00
parent 05b76b96b3
commit 285321dcb9

View file

@ -21,12 +21,10 @@ NPanel {
radius: Style.radiusMedium * scaling radius: Style.radiusMedium * scaling
border.color: Theme.backgroundTertiary border.color: Theme.backgroundTertiary
border.width: Math.max(1, 1.5 * scale) border.width: Math.max(1, 1.5 * scale)
width: 340 * scaling width: 500 * scaling
height: 200 height: 300
anchors.top: parent.top anchors.centerIn: parent
anchors.right: parent.right
anchors.topMargin: 4 * scaling
anchors.rightMargin: 4 * scaling
// Prevent closing when clicking in the panel bg // Prevent closing when clicking in the panel bg
MouseArea { MouseArea {
@ -38,34 +36,63 @@ NPanel {
anchors.margins: 16 * scaling anchors.margins: 16 * scaling
spacing: 12 * scaling spacing: 12 * scaling
NToggle {
label: "Label" // NIconButton
description: "Description" RowLayout {
onToggled: function(value: bool) { spacing: 16 * scaling
console.log("NToggle: " + value) Text {
text: "NIconButton"
color: Theme.textPrimary
}
NIconButton {
id: myIconButton
icon: "refresh"
onEntered: function() {
myTooltip.show();
}
onExited: function() {
myTooltip.hide();
}
} }
} }
NIconButton {
id: myIconButton // NToggle
icon: "refresh" RowLayout {
onEntered: function() { spacing: 16 * scaling
myTooltip.show(); uniformCellSizes: true
Text {
text: "NToggle + NTooltip"
color: Theme.textPrimary
} }
onExited: function() {
myTooltip.hide(); NToggle {
label: "Label"
description: "Description"
onToggled: function(value: bool) {
console.log("NToggle: " + value)
}
}
NTooltip {
id: myTooltip
target: myIconButton
positionAbove: false
text: "Hello world"
} }
} }
NTooltip { // NSlider
id: myTooltip RowLayout {
target: myIconButton spacing: 16 * scaling
positionAbove: false Text {
text: "Hello world" text: "NSlider"
} color: Theme.textPrimary
}
NSlider {} NSlider {}
}
} }
} }