Improve HScrollableTextArea disabled handling

Don't hide text if no disabledText is explicitely set, set opacity
using theme.disableElementsOpacity
This commit is contained in:
miruka 2019-12-13 06:22:09 -04:00
parent 2ca79a212f
commit 4cd4386abe
2 changed files with 9 additions and 9 deletions

View File

@ -4,6 +4,7 @@ import QtQuick.Controls 2.12
ScrollView {
id: scrollView
opacity: enabled ? 1 : theme.disabledElementsOpacity
clip: true
ScrollBar.vertical.visible: contentHeight > height
@ -27,11 +28,12 @@ ScrollView {
property alias placeholderTextColor: textArea.placeholderTextColor
property alias area: textArea
property alias text: textArea.text
property string disabledText: ""
property string disabledTextColor: theme.controls.textArea.disabledText
property var disabledText: null
property var focusItemOnTab: null
Behavior on opacity { HOpacityAnimator {} }
TextArea {
id: textArea
enabled: parent.enabled
@ -64,14 +66,15 @@ ScrollView {
KeyNavigation.priority: KeyNavigation.BeforeItem
KeyNavigation.tab: focusItemOnTab
Binding on color {
value: "transparent"
when: ! textArea.enabled
when: disabledText !== null && ! textArea.enabled
}
Binding on placeholderTextColor {
value: "transparent"
when: ! textArea.enabled
when: disabledText !== null && ! textArea.enabled
}
Behavior on color { HColorAnimation {} }
@ -80,9 +83,8 @@ ScrollView {
HLabel {
anchors.fill: parent
visible: opacity > 0
opacity: parent.enabled ? 0 : 1
color: disabledTextColor
text: disabledText
opacity: disabledText !== null && parent.enabled ? 0 : 1
text: disabledText || ""
leftPadding: parent.leftPadding
rightPadding: parent.rightPadding

View File

@ -171,13 +171,11 @@ controls:
color text: colors.text
color focusedText: colors.text
color placeholderText: colors.dimText
color disabledText: colors.dimText
textArea:
color background: colors.inputBackground
color text: colors.text
color placeholderText: controls.textField.placeholderText
color disabledText: controls.textField.disabledText
toolTip:
int delay: 500