diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-16 22:29:30 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-03-16 22:29:30 +0800 |
commit | 4fcdeafdff1241ff598b7695283f3c44680888df (patch) | |
tree | 6c0b1802961b85645e969b21a5b09c6264920f30 | |
parent | 7d0960bbdced8398bc3cec36e5d15e1c31b54f4d (diff) |
Bootstrap button primary impl & its use in SignIn
-rw-r--r-- | Bootstrap.qrc | 5 | ||||
-rw-r--r-- | Bootstrap/Button/Primary.ui.qml | 20 | ||||
-rw-r--r-- | Bootstrap/icons/LICENSE.md (renamed from Bootstrap/LICENSE.md) | 0 | ||||
-rw-r--r-- | Qeduport.qmlproject | 1 | ||||
-rw-r--r-- | SignIn.ui.qml | 20 | ||||
-rw-r--r-- | imports/Bootstrap/Bootstrap.qml | 24 | ||||
-rw-r--r-- | imports/Bootstrap/qmldir | 2 |
7 files changed, 53 insertions, 19 deletions
diff --git a/Bootstrap.qrc b/Bootstrap.qrc index 5bfd58c..5eaf642 100644 --- a/Bootstrap.qrc +++ b/Bootstrap.qrc @@ -1,5 +1,8 @@ -<RCC> +<!DOCTYPE RCC><RCC version="1.0"> <qresource prefix="qeduport"> + <file>imports/Bootstrap/Bootstrap.qml</file> + <file>imports/Bootstrap/qmldir</file> + <file>Bootstrap/Button/Primary.ui.qml</file> <file>Bootstrap/icons/patch-check-fill.svg</file> <file>Bootstrap/icons/envelope-fill.svg</file> </qresource> diff --git a/Bootstrap/Button/Primary.ui.qml b/Bootstrap/Button/Primary.ui.qml new file mode 100644 index 0000000..e99f56b --- /dev/null +++ b/Bootstrap/Button/Primary.ui.qml @@ -0,0 +1,20 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import Bootstrap 5.3 + +Button { + id: button + font: Bootstrap.btnFont + contentItem: Text { + text: button.text + font: button.font + color: Bootstrap.btnColor + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + } + background: Rectangle { + color: button.down ? Bootstrap.btnActiveBG : button.enabled + ? Bootstrap.btnBg : Bootstrap.btnDisabledBg + radius: 8 + } +} diff --git a/Bootstrap/LICENSE.md b/Bootstrap/icons/LICENSE.md index 47f06b6..47f06b6 100644 --- a/Bootstrap/LICENSE.md +++ b/Bootstrap/icons/LICENSE.md diff --git a/Qeduport.qmlproject b/Qeduport.qmlproject index 17409d8..b88797b 100644 --- a/Qeduport.qmlproject +++ b/Qeduport.qmlproject @@ -19,6 +19,7 @@ Project { filter: "*.ttf" } + importPaths: [ "imports" ] qdsVersion: "3.9" quickVersion: "2.15" multilanguageSupport: true diff --git a/SignIn.ui.qml b/SignIn.ui.qml index da66b5f..6d910dd 100644 --- a/SignIn.ui.qml +++ b/SignIn.ui.qml @@ -1,6 +1,7 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 +import "Bootstrap/Button" as BsBtn Flickable { property string titleHeader: qsTr("Login into Eduport!") @@ -194,28 +195,11 @@ Flickable { } } - Button { + BsBtn.Primary { id: button text: qsTr("Login") implicitHeight: 40 Layout.fillWidth: true - - contentItem: Text { - color: "#ffffff" - text: button.text - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - font { - pointSize: 15 - family: doesntEmbed ? "Roboto" : medium.name - weight: Font.Medium - } - } - - background: Rectangle { - color: button.down ? "#0555a1" : button.enabled ? "#066ac9" : "#a6066ac9" - radius: 8 - } } } diff --git a/imports/Bootstrap/Bootstrap.qml b/imports/Bootstrap/Bootstrap.qml new file mode 100644 index 0000000..321eedf --- /dev/null +++ b/imports/Bootstrap/Bootstrap.qml @@ -0,0 +1,24 @@ +pragma Singleton + +import QtQuick 2.15 + +QtObject { + readonly property color btnColor: "#ffffff" + readonly property color btnBg: "#066ac9" + readonly property color btnActiveBg: "#0555a1" + readonly property color btnDisabledBg: "#a6066ac9" + + readonly property bool haveRoboto: Qt.platform.os === "android" + || Qt.platform.os === "linux" + || Qt.platform.os === "osx" + || Qt.platform.os === "unix" + || Qt.platform.os === "windows" + readonly property FontLoader medium: FontLoader { + source: haveRoboto ? "" : "../../Roboto/Roboto-Medium.ttf" + } + readonly property font btnFont: Qt.font({ + pointSize: 15, + family: haveRoboto ? "Roboto" : medium.name, + weight: Font.Medium + }) +} diff --git a/imports/Bootstrap/qmldir b/imports/Bootstrap/qmldir new file mode 100644 index 0000000..53e8824 --- /dev/null +++ b/imports/Bootstrap/qmldir @@ -0,0 +1,2 @@ +module Bootstrap +singleton Bootstrap 5.3 Bootstrap.qml |