Swap ReadOnlyTextfield to controls 2

CURA-8685
This commit is contained in:
Jaime van Kessel 2022-02-15 15:16:16 +01:00
parent a20dac4c9b
commit da96cb833c
2 changed files with 11 additions and 17 deletions

View File

@ -3,6 +3,7 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import UM 1.5 as UM
ScrollView ScrollView
{ {
@ -26,7 +27,7 @@ ScrollView
background: Rectangle background: Rectangle
{ {
radius: UM.Theme.getSize("setting_control_radius").width radius: UM.Theme.getSize("setting_control_radius").width
color: enabled ? UM.Theme.getColor("setting_control_disabled") : UM.Theme.getColor("setting_control") color: textArea.enabled ? UM.Theme.getColor("setting_control") : UM.Theme.getColor("setting_control_disabled")
} }
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")

View File

@ -3,7 +3,8 @@
// Different than the name suggests, it is not always read-only. // Different than the name suggests, it is not always read-only.
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 import QtQuick.Controls 2.1
import UM 1.5 as UM
Item Item
{ {
@ -23,26 +24,18 @@ Item
id: textField id: textField
enabled: !base.readOnly enabled: !base.readOnly
opacity: base.readOnly ? 0.5 : 1.0
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
anchors.fill: parent anchors.fill: parent
onEditingFinished: base.editingFinished() onEditingFinished: base.editingFinished()
Keys.onEnterPressed: base.editingFinished() Keys.onEnterPressed: base.editingFinished()
Keys.onReturnPressed: base.editingFinished() Keys.onReturnPressed: base.editingFinished()
} background: Rectangle
Label
{ {
visible: base.readOnly radius: UM.Theme.getSize("setting_control_radius").width
text: textField.text color: textField.enabled ? UM.Theme.getColor("setting_control") : UM.Theme.getColor("setting_control_disabled")
}
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: textField.__panel ? textField.__panel.leftMargin : 0
color: palette.buttonText
} }
SystemPalette { id: palette }
} }