Refactor HInterfaceBox and SignIn page
- Cleaned up code - Sizes are standardized - New HCheckBox component - Replace RememberAccount page by a checkbox on the SignIn page - The page can now be flicked if it's not tall enough to display everything - HNumberAnimation now has an overshoot property that will set the right easing type, overshoot and adapt the animation factor/duration. - HImage can now be colorized
This commit is contained in:
48
src/qml/Base/HCheckBox.qml
Normal file
48
src/qml/Base/HCheckBox.qml
Normal file
@@ -0,0 +1,48 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import "../utils.js" as Utils
|
||||
|
||||
CheckBox {
|
||||
id: box
|
||||
spacing: theme.spacing
|
||||
|
||||
property bool highlight: enabled && (hovered || visualFocus)
|
||||
|
||||
indicator: Rectangle {
|
||||
implicitWidth: implicitHeight
|
||||
implicitHeight: box.contentItem.font.pixelSize * 1.5
|
||||
x: box.leftPadding
|
||||
y: box.topPadding + box.availableHeight / 2 - height / 2
|
||||
radius: theme.radius / 1.5
|
||||
|
||||
color: theme.controls.button.background
|
||||
border.color: Utils.hsluv(
|
||||
180, highlight ? 80 : 0, highlight ? 80 : 40, highlight ? 1 : 0.7
|
||||
)
|
||||
|
||||
Behavior on border.color { HColorAnimation { factor: 0.5 } }
|
||||
|
||||
HIcon {
|
||||
anchors.centerIn: parent
|
||||
dimension: parent.width - 2
|
||||
svgName: "check-mark"
|
||||
colorize: theme.colors.accentText
|
||||
|
||||
visible: scale > 0
|
||||
scale: box.checked ? 1 : 0
|
||||
Behavior on scale { HNumberAnimation { overshoot: 4 } }
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: HLabel {
|
||||
text: box.text
|
||||
color: box.enabled ?
|
||||
theme.controls.button.text :
|
||||
theme.controls.button.disabledText
|
||||
|
||||
// Set a width on CheckBox for wrapping to work, e.g. Layout.fillWidth
|
||||
wrapMode: Text.Wrap
|
||||
leftPadding: box.indicator.width + box.spacing
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user