From af65e3444e638557a5a15d9722dc93ef65470760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Thu, 30 Mar 2023 12:26:02 +0800 Subject: Change the way purposed buttons override Btn --- Button/Btn.ui.qml | 23 ++++++++++++++--- Button/Primary.ui.qml | 25 +++++++----------- Button/Success.ui.qml | 25 +++++++----------- imports/Eduport/Eduport.qml | 62 ++++++++++++++++++++++++++++++--------------- 4 files changed, 79 insertions(+), 56 deletions(-) diff --git a/Button/Btn.ui.qml b/Button/Btn.ui.qml index cf5c731..1d58fe8 100644 --- a/Button/Btn.ui.qml +++ b/Button/Btn.ui.qml @@ -3,6 +3,15 @@ import QtQuick.Controls 2.15 import Eduport 1.4 Button { + property color bsBtnColor: Eduport.bsBtnColor + property color bsBtnBg: Eduport.bsBtnBg + property color bsBtnBorderColor: Eduport.bsBtnBorderColor + property color bsBtnActiveColor: Eduport.bsBtnColor + property color bsBtnActiveBg: Eduport.bsBtnBg + property color bsBtnActiveBorderColor: Eduport.bsBtnBorderColor + property color bsBtnDisabledColor: Eduport.bsBtnColor + property color bsBtnDisabledBg: Eduport.bsBtnBg + property color bsBtnDisabledBorderColor: Eduport.bsBtnBorderColor id: button horizontalPadding: Eduport.bsBtnPaddingX verticalPadding: Eduport.bsBtnPaddingY @@ -10,15 +19,23 @@ Button { contentItem: Text { text: button.text font: button.font - color: Eduport.bsBtnPrimaryColor + color: button.down + ? bsBtnActiveColor + : button.enabled + ? bsBtnColor + : bsBtnDisabledColor horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } background: Rectangle { - color: Eduport.bsBtnBg + color: button.down + ? bsBtnActiveBg + : button.enabled + ? bsBtnBg + : bsBtnDisabledBg border { width: Eduport.bsBtnBorderWidth - color: Eduport.bsBtnBorderColor + color: bsBtnBorderColor } radius: Eduport.bsBtnBorderRadius } diff --git a/Button/Primary.ui.qml b/Button/Primary.ui.qml index 810c2f8..1e1aae6 100644 --- a/Button/Primary.ui.qml +++ b/Button/Primary.ui.qml @@ -3,20 +3,13 @@ import QtQuick.Controls 2.15 import Eduport 1.4 Btn { - id: button - background: Rectangle { - color: button.down ? Eduport.bsBtnPrimaryActiveBg - : button.enabled - ? Eduport.bsBtnPrimaryBg - : Eduport.bsBtnPrimaryDisabledBg - border { - width: Eduport.bsBtnBorderWidth - color: button.down - ? Eduport.bsBtnPrimaryActiveBorderColor - : button.enabled - ? Eduport.bsBtnPrimaryBorderColor - : Eduport.bsBtnPrimaryDisabledBorderColor - } - radius: Eduport.bsBtnBorderRadius - } + bsBtnColor: Eduport.bsBtnPrimaryColor + bsBtnBg: Eduport.bsBtnPrimaryBg + bsBtnBorderColor: Eduport.bsBtnPrimaryBorderColor + bsBtnActiveColor: Eduport.bsBtnPrimaryActiveColor + bsBtnActiveBg: Eduport.bsBtnPrimaryActiveBg + bsBtnActiveBorderColor: Eduport.bsBtnPrimaryActiveBorderColor + bsBtnDisabledColor: Eduport.bsBtnPrimaryDisabledColor + bsBtnDisabledBg: Eduport.bsBtnPrimaryDisabledBg + bsBtnDisabledBorderColor: Eduport.bsBtnPrimaryDisabledBorderColor } diff --git a/Button/Success.ui.qml b/Button/Success.ui.qml index 2da78cd..9a1286d 100644 --- a/Button/Success.ui.qml +++ b/Button/Success.ui.qml @@ -3,20 +3,13 @@ import QtQuick.Controls 2.15 import Eduport 1.4 Btn { - id: button - background: Rectangle { - color: button.down ? Eduport.bsBtnSuccessActiveBg - : button.enabled - ? Eduport.bsBtnSuccessBg - : Eduport.bsBtnSuccessDisabledBg - border { - width: Eduport.bsBtnBorderWidth - color: button.down - ? Eduport.bsBtnSuccessActiveBorderColor - : button.enabled - ? Eduport.bsBtnSuccessBorderColor - : Eduport.bsBtnSuccessDisabledBorderColor - } - radius: Eduport.bsBtnBorderRadius - } + bsBtnColor: Eduport.bsBtnSuccessColor + bsBtnBg: Eduport.bsBtnSuccessBg + bsBtnBorderColor: Eduport.bsBtnSuccessBorderColor + bsBtnActiveColor: Eduport.bsBtnSuccessActiveColor + bsBtnActiveBg: Eduport.bsBtnSuccessActiveBg + bsBtnActiveBorderColor: Eduport.bsBtnSuccessActiveBorderColor + bsBtnDisabledColor: Eduport.bsBtnSuccessDisabledColor + bsBtnDisabledBg: Eduport.bsBtnSuccessDisabledBg + bsBtnDisabledBorderColor: Eduport.bsBtnSuccessDisabledBorderColor } diff --git a/imports/Eduport/Eduport.qml b/imports/Eduport/Eduport.qml index 14371b9..85ff011 100644 --- a/imports/Eduport/Eduport.qml +++ b/imports/Eduport/Eduport.qml @@ -40,12 +40,6 @@ QtObject { weight: Font.Normal }) - readonly property color bsPrimary: "#066ac9" - property color bsSecondary: "#9a9ea4" - property color bsLight: mode ? "#2a2c31" : "#f5f7f9" - property color bsDark: mode ? "#0f0f10" : "#24292d" - property color bsTertiaryBg: mode ? "#2b3035" : "#f8f9fa" - readonly property real bsBadgeFontSize: 13.6 property color bsBodyColor: mode ? "#a1a1a8" : "#747579" @@ -66,28 +60,54 @@ QtObject { weight: Font.Medium, pointSize: 15 }) + readonly property color bsBtnColor: "#747579" readonly property color bsBtnBg: "transparent" - readonly property real bsBtnBorderWidth: 1 readonly property color bsBtnBorderColor: bsBtnBg + readonly property real bsBtnBorderWidth: 1 readonly property real bsBtnBorderRadius: 5.2 readonly property real bsBtnLgFontSize: 16 readonly property real bsBtnLgBorderRadius: 8 + + property color bsPrimary: "#066ac9" + property color bsSecondary: "#9a9ea4" + property color bsSuccess: "#0cbc87" + property color bsDanger: "#d6293e" + property color bsLight: mode ? "#2a2c31" : "#f5f7f9" + property color bsDark: mode ? "#0f0f10" : "#24292d" + property color bsTertiaryBg: mode ? "#2b3035" : "#f8f9fa" + property color bsBtnPrimaryColor: "#ffffff" - readonly property color bsBtnPrimaryBg: bsPrimary - readonly property color bsBtnPrimaryBorderColor: bsPrimary - readonly property color bsBtnPrimaryActiveBg: "#0555a1" - readonly property color bsBtnPrimaryActiveBorderColor: "#055097" - readonly property color bsBtnPrimaryDisabledBg: "#a6066ac9" - readonly property color bsBtnPrimaryDisabledBorderColor: - bsBtnPrimaryDisabledBg - readonly property color bsBtnSuccessBg: "#0cbc87" - readonly property color bsBtnSuccessBorderColor: bsBtnSuccessBg - readonly property color bsBtnSuccessActiveBg: "#0a966c" - readonly property color bsBtnSuccessActiveBorderColor: "#098d65" - readonly property color bsBtnSuccessDisabledBg: "#a60cbc87" - readonly property color bsBtnSuccessDisabledBorderColor: - bsBtnSuccessDisabledBg + property color bsBtnPrimaryBg: bsPrimary + property color bsBtnPrimaryBorderColor: bsPrimary + property color bsBtnPrimaryActiveColor: bsBtnPrimaryColor + property color bsBtnPrimaryActiveBg: "#0555a1" + property color bsBtnPrimaryActiveBorderColor: "#055097" + property color bsBtnPrimaryDisabledColor: "#a6ffffff" + property color bsBtnPrimaryDisabledBg: "#a6066ac9" + property color bsBtnPrimaryDisabledBorderColor: bsBtnPrimaryDisabledBg + + property color bsBtnOutlinePrimaryColor: bsPrimary + property color bsBtnOutlinePrimaryBg: bsBtnBg + property color bsBtnOutlinePrimaryBorderColor: bsPrimary + property color bsBtnOutlinePrimaryActiveColor: bsBtnPrimaryColor + property color bsBtnOutlinePrimaryActiveBg: bsPrimary + property color bsBtnOutlinePrimaryActiveBorderColor: bsPrimary + property color bsBtnOutlinePrimaryDisabledColor: + bsBtnPrimaryDisabledColor + property color bsBtnOutlinePrimaryDisabledBg: bsBtnBg + property color bsBtnOutlinePrimaryDisabledBorderColor: + bsBtnPrimaryDisabledColor + + property color bsBtnSuccessColor: bsBtnPrimaryColor + property color bsBtnSuccessBg: bsSuccess + property color bsBtnSuccessBorderColor: bsSuccess + property color bsBtnSuccessActiveColor: bsBtnSuccessColor + property color bsBtnSuccessActiveBg: "#0a966c" + property color bsBtnSuccessActiveBorderColor: "#098d65" + property color bsBtnSuccessDisabledColor: bsBtnPrimaryDisabledColor + property color bsBtnSuccessDisabledBg: "#a60cbc87" + property color bsBtnSuccessDisabledBorderColor: bsBtnSuccessDisabledBg property color bsCardBg: mode ? "#1b1e21" : "#ffffff" property color bsCardTitleColor: mode ? "#f7f5f5" : "#24292d" -- cgit v1.2.3