18 changed files with 156 additions and 20 deletions
			
			
		@ -0,0 +1,18 @@ | 
				
			|||||
 | 
					import QtQuick 2.13 | 
				
			||||
 | 
					import "./SepantaUiKit/SKBtn" | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Item { | 
				
			||||
 | 
					    anchors.fill: parent | 
				
			||||
 | 
					    Grid { | 
				
			||||
 | 
					        spacing: 20 | 
				
			||||
 | 
					        anchors.margins: 20 | 
				
			||||
 | 
					        anchors.fill: parent | 
				
			||||
 | 
					        SKBtn { | 
				
			||||
 | 
					            text: "Enable" | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        SKBtn { | 
				
			||||
 | 
					            text: "Disable" | 
				
			||||
 | 
					            isEnable: false | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -1,40 +1,42 @@ | 
				
			|||||
import QtQuick 2.15 | 
					pragma Singleton | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import QtQuick 2.13 | 
				
			||||
 | 
					
 | 
				
			||||
Item { | 
					Item { | 
				
			||||
    property font h1: Qt.font({ | 
					    property font h1: Qt.font({ | 
				
			||||
                                  "family": 'Roboto', | 
					                                  "family": 'Roboto', | 
				
			||||
                                  "weight": Font.Normal, | 
					                                  "weight": Font.Normal, | 
				
			||||
                                  "italic": false, | 
					                                  "italic": false, | 
				
			||||
                                  "pointSize": 40 | 
					                                  "pixelSize": 40 | 
				
			||||
                              }) | 
					                              }) | 
				
			||||
    property font h2: Qt.font({ | 
					    property font h2: Qt.font({ | 
				
			||||
                                  "family": 'Roboto', | 
					                                  "family": 'Roboto', | 
				
			||||
                                  "weight": Font.Medium, | 
					                                  "weight": Font.Medium, | 
				
			||||
                                  "italic": false, | 
					                                  "italic": false, | 
				
			||||
                                  "pointSize": 20 | 
					                                  "pixelSize": 20 | 
				
			||||
                              }) | 
					                              }) | 
				
			||||
    property font h3: Qt.font({ | 
					    property font h3: Qt.font({ | 
				
			||||
                                  "family": 'Roboto', | 
					                                  "family": 'Roboto', | 
				
			||||
                                  "weight": Font.Bold, | 
					                                  "weight": Font.Bold, | 
				
			||||
                                  "italic": false, | 
					                                  "italic": false, | 
				
			||||
                                  "pointSize": 16 | 
					                                  "pixelSize": 16 | 
				
			||||
                              }) | 
					                              }) | 
				
			||||
    property font h4: Qt.font({ | 
					    property font h4: Qt.font({ | 
				
			||||
                                  "family": 'Roboto', | 
					                                  "family": 'Roboto', | 
				
			||||
                                  "weight": Font.DemiBold, | 
					                                  "weight": Font.DemiBold, | 
				
			||||
                                  "italic": false, | 
					                                  "italic": false, | 
				
			||||
                                  "pointSize": 16 | 
					                                  "pixelSize": 16 | 
				
			||||
                              }) | 
					                              }) | 
				
			||||
    property font h5: Qt.font({ | 
					    property font h5: Qt.font({ | 
				
			||||
                                  "family": 'Roboto', | 
					                                  "family": 'Roboto', | 
				
			||||
                                  "weight": Font.Normal, | 
					                                  "weight": Font.Normal, | 
				
			||||
                                  "italic": false, | 
					                                  "italic": false, | 
				
			||||
                                  "pointSize": 16 | 
					                                  "pixelSize": 16 | 
				
			||||
                              }) | 
					                              }) | 
				
			||||
    property font h6: Qt.font({ | 
					    property font h6: Qt.font({ | 
				
			||||
                                  "family": 'Roboto', | 
					                                  "family": 'Roboto', | 
				
			||||
                                  "weight": Font.Normal, | 
					                                  "weight": Font.Normal, | 
				
			||||
                                  "italic": false, | 
					                                  "italic": false, | 
				
			||||
                                  "pointSize": 12 | 
					                                  "pixelSize": 12 | 
				
			||||
                              }) | 
					                              }) | 
				
			||||
} | 
					} | 
				
			||||
 | 
				
			|||||
@ -1,5 +1,87 @@ | 
				
			|||||
import QtQuick 2.15 | 
					import QtQuick 2.13 | 
				
			||||
 | 
					import QtQml 2.13 | 
				
			||||
 | 
					import "qrc:/SepantaUiKit" | 
				
			||||
 | 
					
 | 
				
			||||
Item { | 
					Item { | 
				
			||||
 | 
					    id: root | 
				
			||||
 | 
					    width: 140 | 
				
			||||
 | 
					    height: 50 | 
				
			||||
 | 
					    property bool isEnable: true | 
				
			||||
 | 
					    onIsEnableChanged: enableHandle() | 
				
			||||
 | 
					    function enableHandle() { | 
				
			||||
 | 
					        if (isEnable) { | 
				
			||||
 | 
					            stateOfComponent = Setting.Enable | 
				
			||||
 | 
					        } else { | 
				
			||||
 | 
					            stateOfComponent = Setting.Disabel | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    property var stateOfComponent: Setting.Enable | 
				
			||||
 | 
					    onStateOfComponentChanged: stateChanged() | 
				
			||||
 | 
					    property alias text: idText.text | 
				
			||||
 | 
					    Rectangle { | 
				
			||||
 | 
					        id: idBackGround | 
				
			||||
 | 
					        anchors.fill: parent | 
				
			||||
 | 
					        radius: Setting.radius | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        Text { | 
				
			||||
 | 
					            id: idText | 
				
			||||
 | 
					            anchors.fill: parent | 
				
			||||
 | 
					            horizontalAlignment: Text.AlignHCenter | 
				
			||||
 | 
					            verticalAlignment: Text.AlignVCenter | 
				
			||||
 | 
					            color: Colors.balck | 
				
			||||
 | 
					            font: Fonts.h3 | 
				
			||||
 | 
					            Component.onCompleted: console.log(JSON.stringify(idText.fontInfo)) | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        Behavior on color { | 
				
			||||
 | 
					            ColorAnimation { | 
				
			||||
 | 
					                duration: Setting.animationDuration | 
				
			||||
 | 
					            } | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    MouseArea { | 
				
			||||
 | 
					        anchors.fill: parent | 
				
			||||
 | 
					        hoverEnabled: true | 
				
			||||
 | 
					        onHoveredChanged: { | 
				
			||||
 | 
					            if (isEnable) { | 
				
			||||
 | 
					                if (containsMouse) { | 
				
			||||
 | 
					                    stateOfComponent = Setting.Hoverd | 
				
			||||
 | 
					                } else { | 
				
			||||
 | 
					                    stateOfComponent = Setting.Enable | 
				
			||||
 | 
					                } | 
				
			||||
 | 
					            } | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        onPressed: { | 
				
			||||
 | 
					            if (isEnable) { | 
				
			||||
 | 
					                stateOfComponent = Setting.Pressed | 
				
			||||
 | 
					            } | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        onReleased: { | 
				
			||||
 | 
					            if (isEnable) { | 
				
			||||
 | 
					                stateOfComponent = Setting.Enable | 
				
			||||
 | 
					            } | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    function stateChanged() { | 
				
			||||
 | 
					        switch (stateOfComponent) { | 
				
			||||
 | 
					        case Setting.Enable: | 
				
			||||
 | 
					            idBackGround.color = Colors.primaryEnable | 
				
			||||
 | 
					            break | 
				
			||||
 | 
					        case Setting.Pressed: | 
				
			||||
 | 
					            idBackGround.color = Colors.primaryPressed | 
				
			||||
 | 
					            break | 
				
			||||
 | 
					        case Setting.Hoverd: | 
				
			||||
 | 
					            idBackGround.color = Qt.lighter(Colors.primaryEnable, 1.07) | 
				
			||||
 | 
					            break | 
				
			||||
 | 
					        case Setting.Disabel: | 
				
			||||
 | 
					            idBackGround.color = Qt.darker(Colors.primaryEnable, 4) | 
				
			||||
 | 
					            break | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    Component.onCompleted: { | 
				
			||||
 | 
					        enableHandle() | 
				
			||||
 | 
					        stateChanged() | 
				
			||||
 | 
					    } | 
				
			||||
} | 
					} | 
				
			||||
 | 
				
			|||||
@ -0,0 +1,17 @@ | 
				
			|||||
 | 
					pragma Singleton | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					import QtQuick 2.13 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Item { | 
				
			||||
 | 
					    property int radius: 25 | 
				
			||||
 | 
					    property real disableOpacity: 0.25 | 
				
			||||
 | 
					    property real hoverOpacity: 0.20 | 
				
			||||
 | 
					    property int animationDuration: 200 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    enum State { | 
				
			||||
 | 
					        Enable, | 
				
			||||
 | 
					        Pressed, | 
				
			||||
 | 
					        Hoverd, | 
				
			||||
 | 
					        Disabel | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,5 @@ | 
				
			|||||
 | 
					import QtQuick 2.13 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Item { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,3 @@ | 
				
			|||||
 | 
					singleton Colors 1.0 Colors.qml | 
				
			||||
 | 
					singleton Fonts 1.0 Fonts.qml | 
				
			||||
 | 
					singleton Setting 1.0 Setting.qml | 
				
			||||
					Loading…
					
					
				
		Reference in new issue