|
@ -7,18 +7,13 @@ Item { |
|
|
width: 140 |
|
|
width: 140 |
|
|
height: 50 |
|
|
height: 50 |
|
|
property bool isEnable: true |
|
|
property bool isEnable: true |
|
|
onIsEnableChanged: enableHandle() |
|
|
property var buttonType: Setting.Primary |
|
|
function enableHandle() { |
|
|
|
|
|
if (isEnable) { |
|
|
|
|
|
stateOfComponent = Setting.Enable |
|
|
|
|
|
} else { |
|
|
|
|
|
stateOfComponent = Setting.Disabel |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
property var stateOfComponent: Setting.Enable |
|
|
property var stateOfComponent: Setting.Enable |
|
|
onStateOfComponentChanged: stateChanged() |
|
|
|
|
|
property alias text: idText.text |
|
|
property alias text: idText.text |
|
|
|
|
|
|
|
|
|
|
|
onIsEnableChanged: enableHandle() |
|
|
|
|
|
onStateOfComponentChanged: stateChanged() |
|
|
|
|
|
//======================================================================== |
|
|
Rectangle { |
|
|
Rectangle { |
|
|
id: idBackGround |
|
|
id: idBackGround |
|
|
anchors.fill: parent |
|
|
anchors.fill: parent |
|
@ -31,7 +26,11 @@ Item { |
|
|
verticalAlignment: Text.AlignVCenter |
|
|
verticalAlignment: Text.AlignVCenter |
|
|
color: Colors.balck |
|
|
color: Colors.balck |
|
|
font: Fonts.h3 |
|
|
font: Fonts.h3 |
|
|
Component.onCompleted: console.log(JSON.stringify(idText.fontInfo)) |
|
|
Behavior on color { |
|
|
|
|
|
ColorAnimation { |
|
|
|
|
|
duration: Setting.animationDuration |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
Behavior on color { |
|
|
Behavior on color { |
|
|
ColorAnimation { |
|
|
ColorAnimation { |
|
@ -62,21 +61,70 @@ Item { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//======================================================================== |
|
|
function stateChanged() { |
|
|
function stateChanged() { |
|
|
switch (stateOfComponent) { |
|
|
if (buttonType === Setting.Primary) { |
|
|
case Setting.Enable: |
|
|
switch (stateOfComponent) { |
|
|
idBackGround.color = Colors.primaryEnable |
|
|
case Setting.Enable: |
|
|
break |
|
|
idBackGround.color = Colors.primaryEnable |
|
|
case Setting.Pressed: |
|
|
break |
|
|
idBackGround.color = Colors.primaryPressed |
|
|
case Setting.Pressed: |
|
|
break |
|
|
idBackGround.color = Colors.primaryPressed |
|
|
case Setting.Hoverd: |
|
|
break |
|
|
idBackGround.color = Qt.lighter(Colors.primaryEnable, 1.07) |
|
|
case Setting.Hoverd: |
|
|
break |
|
|
idBackGround.color = Qt.lighter(Colors.primaryEnable, |
|
|
case Setting.Disabel: |
|
|
Setting.hoverCoeffecient) |
|
|
idBackGround.color = Qt.darker(Colors.primaryEnable, 4) |
|
|
break |
|
|
break |
|
|
case Setting.Disabel: |
|
|
|
|
|
idBackGround.color = Qt.darker(Colors.primaryEnable, |
|
|
|
|
|
Setting.disableCoeffecient) |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} else if (buttonType === Setting.Secondary) { |
|
|
|
|
|
switch (stateOfComponent) { |
|
|
|
|
|
case Setting.Enable: |
|
|
|
|
|
idBackGround.color = Colors.secondaryEnable |
|
|
|
|
|
break |
|
|
|
|
|
case Setting.Pressed: |
|
|
|
|
|
idBackGround.color = Colors.secondaryPressed |
|
|
|
|
|
break |
|
|
|
|
|
case Setting.Hoverd: |
|
|
|
|
|
idBackGround.color = Qt.lighter(Colors.secondaryEnable, |
|
|
|
|
|
Setting.hoverCoeffecient) |
|
|
|
|
|
break |
|
|
|
|
|
case Setting.Disabel: |
|
|
|
|
|
idBackGround.color = Qt.darker(Colors.secondaryEnable, |
|
|
|
|
|
Setting.disableCoeffecient) |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} else if (buttonType === Setting.Tertiary) { |
|
|
|
|
|
idBackGround.color = Colors.balck |
|
|
|
|
|
idBackGround.border.width = 1 |
|
|
|
|
|
idBackGround.border.color = Colors.tertiaryEnable |
|
|
|
|
|
idText.color = Colors.white |
|
|
|
|
|
switch (stateOfComponent) { |
|
|
|
|
|
case Setting.Enable: |
|
|
|
|
|
idBackGround.border.color = Colors.tertiaryEnable |
|
|
|
|
|
break |
|
|
|
|
|
case Setting.Pressed: |
|
|
|
|
|
idBackGround.border.color = Colors.tertiaryPressed |
|
|
|
|
|
break |
|
|
|
|
|
case Setting.Hoverd: |
|
|
|
|
|
idBackGround.border.color = Qt.lighter(Colors.tertiaryEnable, |
|
|
|
|
|
Setting.hoverCoeffecient) |
|
|
|
|
|
break |
|
|
|
|
|
case Setting.Disabel: |
|
|
|
|
|
idBackGround.border.color = Qt.darker( |
|
|
|
|
|
Colors.tertiaryEnable, Setting.disableCoeffecient) |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
function enableHandle() { |
|
|
|
|
|
if (isEnable) { |
|
|
|
|
|
stateOfComponent = Setting.Enable |
|
|
|
|
|
} else { |
|
|
|
|
|
stateOfComponent = Setting.Disabel |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|