HTextField active color, HColorAnimation + factor
This commit is contained in:
parent
271b3e3829
commit
d8295302a5
1
TODO.md
1
TODO.md
|
@ -1,6 +1,7 @@
|
||||||
- HTextField focus effect
|
- HTextField focus effect
|
||||||
- Devices and client settings in edit account page
|
- Devices and client settings in edit account page
|
||||||
- If avatar is set, name color from average color?
|
- If avatar is set, name color from average color?
|
||||||
|
- Accent color from background
|
||||||
- Reduce messages ListView cacheBuffer height once http thumbnails
|
- Reduce messages ListView cacheBuffer height once http thumbnails
|
||||||
downloading is implemented
|
downloading is implemented
|
||||||
- Button can get "hoverEnabled: false" to let HoverHandlers work
|
- Button can get "hoverEnabled: false" to let HoverHandlers work
|
||||||
|
|
|
@ -33,9 +33,7 @@ Button {
|
||||||
)
|
)
|
||||||
radius: circle ? height : 0
|
radius: circle ? height : 0
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color { HColorAnimation { factor: 0.5 } }
|
||||||
ColorAnimation { duration: theme.animationDuration / 2 }
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: buttonBackgroundOverlay
|
id: buttonBackgroundOverlay
|
||||||
|
@ -44,9 +42,7 @@ Button {
|
||||||
color: "black"
|
color: "black"
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity { HNumberAnimation { factor: 0.5 } }
|
||||||
HNumberAnimation { duration: theme.animationDuration / 2 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
src/qml/Base/HColorAnimation.qml
Normal file
9
src/qml/Base/HColorAnimation.qml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// Copyright 2019 miruka
|
||||||
|
// This file is part of harmonyqml, licensed under LGPLv3.
|
||||||
|
|
||||||
|
import QtQuick 2.12
|
||||||
|
|
||||||
|
ColorAnimation {
|
||||||
|
property real factor: 1.0
|
||||||
|
duration: theme.animationDuration * factor
|
||||||
|
}
|
|
@ -17,9 +17,7 @@ HRectangle {
|
||||||
hover.hovered ? hoveredColor :
|
hover.hovered ? hoveredColor :
|
||||||
normalColor
|
normalColor
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color { HColorAnimation { factor: 0.66 } }
|
||||||
ColorAnimation { duration: theme.animationDuration / 1.5 }
|
|
||||||
}
|
|
||||||
|
|
||||||
HoverHandler { id: hover }
|
HoverHandler { id: hover }
|
||||||
TapHandler { id: tap }
|
TapHandler { id: tap }
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
|
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: theme.animationDuration
|
property real factor: 1.0
|
||||||
|
duration: theme.animationDuration * factor
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,29 @@ import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
|
|
||||||
TextField {
|
TextField {
|
||||||
property bool bordered: false
|
id: field
|
||||||
property alias backgroundColor: textFieldBackground.color
|
|
||||||
property alias radius: textFieldBackground.radius
|
|
||||||
|
|
||||||
font.family: theme.fontFamily.sans
|
font.family: theme.fontFamily.sans
|
||||||
font.pixelSize: theme.fontSize.normal
|
font.pixelSize: theme.fontSize.normal
|
||||||
|
|
||||||
|
readonly property QtObject _tf: theme.controls.textField
|
||||||
|
|
||||||
|
property bool bordered: false
|
||||||
|
property color backgroundColor: _tf.background
|
||||||
|
property color borderColor: _tf.border
|
||||||
|
property color focusedBackgroundColor: _tf.focusedBackground
|
||||||
|
property color focusedBorderColor: _tf.focusedBorder
|
||||||
|
property alias radius: textFieldBackground.radius
|
||||||
|
|
||||||
color: theme.colors.foreground
|
color: theme.colors.foreground
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
id: textFieldBackground
|
id: textFieldBackground
|
||||||
color: theme.controls.textField.background
|
color: field.activeFocus ? focusedBackgroundColor : backgroundColor
|
||||||
border.color: theme.controls.textField.borderColor
|
border.color: field.activeFocus ? focusedBorderColor : borderColor
|
||||||
border.width: bordered ? theme.controls.textField.borderWidth : 0
|
border.width: bordered ? theme.controls.textField.borderWidth : 0
|
||||||
|
|
||||||
|
Behavior on color { HColorAnimation {} }
|
||||||
|
Behavior on border.color { HColorAnimation {} }
|
||||||
|
Behavior on border.width { HNumberAnimation {} }
|
||||||
}
|
}
|
||||||
|
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
|
|
|
@ -45,7 +45,7 @@ QtObject {
|
||||||
property color foregroundDim2: Ut.hsl(0, 0, 30)
|
property color foregroundDim2: Ut.hsl(0, 0, 30)
|
||||||
property color foregroundError: Ut.hsl(342, 64, 32)
|
property color foregroundError: Ut.hsl(342, 64, 32)
|
||||||
property color textBorder: Ut.hsla(0, 0, 0, 0.07)
|
property color textBorder: Ut.hsla(0, 0, 0, 0.07)
|
||||||
property color accent: Ut.hsl(160, 62, 55)
|
property color accent: Ut.hsl(25, 60, 50)
|
||||||
}
|
}
|
||||||
|
|
||||||
property QtObject controls: QtObject {
|
property QtObject controls: QtObject {
|
||||||
|
@ -62,7 +62,9 @@ QtObject {
|
||||||
|
|
||||||
property QtObject textField: QtObject {
|
property QtObject textField: QtObject {
|
||||||
property color background: colors.background2
|
property color background: colors.background2
|
||||||
property color borderColor: "black"
|
property color border: "black"
|
||||||
|
property color focusedBackground: background
|
||||||
|
property color focusedBorder: colors.accent
|
||||||
property int borderWidth: 1
|
property int borderWidth: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user