NToggle: support for different size
This commit is contained in:
parent
f5cb7b183d
commit
13841f959d
1 changed files with 5 additions and 4 deletions
|
|
@ -11,6 +11,7 @@ RowLayout {
|
||||||
property string description: ""
|
property string description: ""
|
||||||
property bool value: false
|
property bool value: false
|
||||||
property bool hovering: false
|
property bool hovering: false
|
||||||
|
property int baseSize: Style.baseWidgetSize
|
||||||
property var onToggled: function (value) {}
|
property var onToggled: function (value) {}
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -38,16 +39,16 @@ RowLayout {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: switcher
|
id: switcher
|
||||||
|
|
||||||
width: Style.baseWidgetSize * 1.625 * scaling
|
width: root.baseSize * 1.625 * scaling
|
||||||
height: Style.baseWidgetSize * scaling
|
height: root.baseSize * scaling
|
||||||
radius: height * 0.5
|
radius: height * 0.5
|
||||||
color: value ? Colors.accentPrimary : Colors.surfaceVariant
|
color: value ? Colors.accentPrimary : Colors.surfaceVariant
|
||||||
border.color: value ? Colors.accentPrimary : Colors.outline
|
border.color: value ? Colors.accentPrimary : Colors.outline
|
||||||
border.width: Math.max(1, Style.borderMedium * scaling)
|
border.width: Math.max(1, Style.borderMedium * scaling)
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: (Style.baseWidgetSize - 4) * scaling
|
width: (root.baseSize - 4) * scaling
|
||||||
height: (Style.baseWidgetSize - 4) * scaling
|
height: (root.baseSize - 4) * scaling
|
||||||
radius: height * 0.5
|
radius: height * 0.5
|
||||||
color: Colors.surface
|
color: Colors.surface
|
||||||
border.color: hovering ? Colors.textDisabled : Colors.outline
|
border.color: hovering ? Colors.textDisabled : Colors.outline
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue