NCheckbox+NToggle: better look
This commit is contained in:
parent
af0f4818d8
commit
b163dab241
2 changed files with 13 additions and 12 deletions
|
|
@ -13,7 +13,7 @@ RowLayout {
|
|||
property bool hovering: false
|
||||
property color activeColor: Color.mPrimary
|
||||
property color activeOnColor: Color.mOnPrimary
|
||||
property int baseSize: Math.max(Style.baseWidgetSize * 0.7, 14)
|
||||
property int baseSize: Style.baseWidgetSize * 0.7
|
||||
|
||||
signal toggled(bool checked)
|
||||
signal entered
|
||||
|
|
@ -35,12 +35,12 @@ RowLayout {
|
|||
Rectangle {
|
||||
id: box
|
||||
|
||||
implicitWidth: root.baseSize * scaling
|
||||
implicitHeight: root.baseSize * scaling
|
||||
implicitWidth: Math.round(root.baseSize * scaling)
|
||||
implicitHeight: Math.round(root.baseSize * scaling)
|
||||
radius: Style.radiusXS * scaling
|
||||
color: root.checked ? root.activeColor : Color.mSurface
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderM * scaling)
|
||||
border.width: Math.max(1, Style.borderS * scaling)
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
|
|
@ -60,7 +60,8 @@ RowLayout {
|
|||
anchors.horizontalCenterOffset: -1 * scaling
|
||||
icon: "check"
|
||||
color: root.activeOnColor
|
||||
font.pointSize: Math.max(Style.fontSizeXS, root.baseSize * 0.6) * scaling
|
||||
font.pointSize: Math.max(Style.fontSizeXS, root.baseSize * 0.5) * scaling
|
||||
font.weight: Style.fontWeightBold
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ RowLayout {
|
|||
property string description: ""
|
||||
property bool checked: false
|
||||
property bool hovering: false
|
||||
property int baseSize: Style.baseWidgetSize * 0.8
|
||||
property int baseSize: Math.round(Style.baseWidgetSize * 0.8)
|
||||
|
||||
signal toggled(bool checked)
|
||||
signal entered
|
||||
|
|
@ -27,12 +27,12 @@ RowLayout {
|
|||
Rectangle {
|
||||
id: switcher
|
||||
|
||||
implicitWidth: root.baseSize * 1.625 * scaling
|
||||
implicitHeight: root.baseSize * scaling
|
||||
implicitWidth: Math.round(root.baseSize * 1.625 * scaling)
|
||||
implicitHeight: Math.round(root.baseSize * scaling)
|
||||
radius: height * 0.5
|
||||
color: root.checked ? Color.mPrimary : Color.mSurface
|
||||
border.color: Color.mOutline
|
||||
border.width: Math.max(1, Style.borderM * scaling)
|
||||
border.width: Math.max(1, Style.borderS* scaling)
|
||||
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
|
|
@ -47,14 +47,14 @@ RowLayout {
|
|||
}
|
||||
|
||||
Rectangle {
|
||||
implicitWidth: (root.baseSize - 5) * scaling
|
||||
implicitHeight: (root.baseSize - 5) * scaling
|
||||
implicitWidth: Math.round((root.baseSize * 0.8) * scaling)
|
||||
implicitHeight: Math.round((root.baseSize * 0.8) * scaling)
|
||||
radius: height * 0.5
|
||||
color: root.checked ? Color.mOnPrimary : Color.mPrimary
|
||||
border.color: root.checked ? Color.mSurface : Color.mSurface
|
||||
border.width: Math.max(1, Style.borderM * scaling)
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: root.checked ? switcher.width - width - 2 * scaling : 2 * scaling
|
||||
x: root.checked ? switcher.width - width - 3 * scaling : 3 * scaling
|
||||
|
||||
Behavior on x {
|
||||
NumberAnimation {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue