Use clearer styling of disabled entry fields on the materials page

Contributes to CURA-342
This commit is contained in:
Arjen Hiemstra 2016-07-07 17:32:49 +02:00
parent 7df5008d3c
commit 6b9689c2c7
4 changed files with 136 additions and 14 deletions

View file

@ -45,7 +45,7 @@ TabView
property real rowHeight: textField.height;
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Brand") }
TextField
ReadOnlyTextField
{
id: textField;
width: base.secondColumnWidth;
@ -55,7 +55,7 @@ TabView
}
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") }
TextField
ReadOnlyTextField
{
width: base.secondColumnWidth;
text: properties.material_type;
@ -85,7 +85,7 @@ TabView
MouseArea { anchors.fill: parent; onClicked: colorDialog.open(); enabled: base.editingEnabled }
}
TextField
ReadOnlyTextField
{
id: colorLabel;
text: properties.color_name;
@ -167,7 +167,7 @@ TabView
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Description") }
TextArea
ReadOnlyTextArea
{
text: properties.description;
width: base.firstColumnWidth + base.secondColumnWidth
@ -180,13 +180,14 @@ TabView
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Adhesion Information") }
TextArea
ReadOnlyTextArea
{
text: properties.adhesion_info;
width: base.firstColumnWidth + base.secondColumnWidth
wrapMode: Text.WordWrap
readOnly: !base.editingEnabled;
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "adhesion_info", text)
}
}

View file

@ -5,19 +5,48 @@ import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.2
// Provides a SpinBox with the same readOnly property as a TextField
SpinBox
Item
{
id: base
property alias value: spinBox.value
property alias minimumValue: spinBox.minimumValue
property alias maximumValue: spinBox.maximumValue
property alias stepSize: spinBox.stepSize
property alias prefix: spinBox.prefix
property alias suffix: spinBox.suffix
property alias decimals: spinBox.decimals
signal editingFinished();
property bool readOnly: false
Keys.enabled: !readOnly
MouseArea
width: spinBox.width
height: spinBox.height
SpinBox
{
acceptedButtons: Qt.AllButtons;
anchors.fill: parent;
enabled: parent.readOnly;
onWheel: wheel.accepted = true;
cursorShape: enabled ? Qt.ArrowCursor : Qt.IBeamCursor;
id: spinBox
enabled: !base.readOnly
opacity: base.readOnly ? 0.5 : 1.0
anchors.fill: parent
onEditingFinished: base.editingFinished()
}
Label
{
visible: base.readOnly
text: base.prefix + base.value.toFixed(spinBox.decimals) + base.suffix
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: spinBox.__style ? spinBox.__style.padding.left : 0
color: palette.buttonText
}
SystemPalette { id: palette }
}

View file

@ -0,0 +1,46 @@
// Copyright (c) 2016 Ultimaker B.V.
// Uranium is released under the terms of the AGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.2
Item
{
id: base
property alias text: textArea.text
property alias wrapMode: textArea.wrapMode
signal editingFinished();
property bool readOnly: false
width: textArea.width
height: textArea.height
TextArea
{
id: textArea
enabled: !base.readOnly
opacity: base.readOnly ? 0.5 : 1.0
anchors.fill: parent
onEditingFinished: base.editingFinished()
}
Label
{
visible: base.readOnly
text: textArea.text
anchors.fill: parent
anchors.margins: textArea.__style ? textArea.__style.textMargin : 4
color: palette.buttonText
}
SystemPalette { id: palette }
}

View file

@ -0,0 +1,46 @@
// Copyright (c) 2016 Ultimaker B.V.
// Uranium is released under the terms of the AGPLv3 or higher.
import QtQuick 2.1
import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.2
Item
{
id: base
property alias text: textField.text
signal editingFinished();
property bool readOnly: false
width: textField.width
height: textField.height
TextField
{
id: textField
enabled: !base.readOnly
opacity: base.readOnly ? 0.5 : 1.0
anchors.fill: parent
onEditingFinished: base.editingFinished()
}
Label
{
visible: base.readOnly
text: textField.text
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: textField.__panel ? textField.__panel.leftMargin : 0
color: palette.buttonText
}
SystemPalette { id: palette }
}