mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 06:03:57 -06:00
Use clearer styling of disabled entry fields on the materials page
Contributes to CURA-342
This commit is contained in:
parent
7df5008d3c
commit
6b9689c2c7
4 changed files with 136 additions and 14 deletions
|
@ -45,7 +45,7 @@ TabView
|
||||||
property real rowHeight: textField.height;
|
property real rowHeight: textField.height;
|
||||||
|
|
||||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Brand") }
|
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Brand") }
|
||||||
TextField
|
ReadOnlyTextField
|
||||||
{
|
{
|
||||||
id: textField;
|
id: textField;
|
||||||
width: base.secondColumnWidth;
|
width: base.secondColumnWidth;
|
||||||
|
@ -55,7 +55,7 @@ TabView
|
||||||
}
|
}
|
||||||
|
|
||||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") }
|
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") }
|
||||||
TextField
|
ReadOnlyTextField
|
||||||
{
|
{
|
||||||
width: base.secondColumnWidth;
|
width: base.secondColumnWidth;
|
||||||
text: properties.material_type;
|
text: properties.material_type;
|
||||||
|
@ -85,7 +85,7 @@ TabView
|
||||||
|
|
||||||
MouseArea { anchors.fill: parent; onClicked: colorDialog.open(); enabled: base.editingEnabled }
|
MouseArea { anchors.fill: parent; onClicked: colorDialog.open(); enabled: base.editingEnabled }
|
||||||
}
|
}
|
||||||
TextField
|
ReadOnlyTextField
|
||||||
{
|
{
|
||||||
id: colorLabel;
|
id: colorLabel;
|
||||||
text: properties.color_name;
|
text: properties.color_name;
|
||||||
|
@ -167,7 +167,7 @@ TabView
|
||||||
|
|
||||||
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Description") }
|
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Description") }
|
||||||
|
|
||||||
TextArea
|
ReadOnlyTextArea
|
||||||
{
|
{
|
||||||
text: properties.description;
|
text: properties.description;
|
||||||
width: base.firstColumnWidth + base.secondColumnWidth
|
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") }
|
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Adhesion Information") }
|
||||||
|
|
||||||
TextArea
|
ReadOnlyTextArea
|
||||||
{
|
{
|
||||||
text: properties.adhesion_info;
|
text: properties.adhesion_info;
|
||||||
width: base.firstColumnWidth + base.secondColumnWidth
|
width: base.firstColumnWidth + base.secondColumnWidth
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
|
||||||
readOnly: !base.editingEnabled;
|
readOnly: !base.editingEnabled;
|
||||||
|
|
||||||
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "adhesion_info", text)
|
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "adhesion_info", text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,48 @@ import QtQuick 2.1
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.1
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
// Provides a SpinBox with the same readOnly property as a TextField
|
Item
|
||||||
SpinBox
|
|
||||||
{
|
{
|
||||||
id: base
|
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
|
property bool readOnly: false
|
||||||
|
|
||||||
Keys.enabled: !readOnly
|
width: spinBox.width
|
||||||
MouseArea
|
height: spinBox.height
|
||||||
|
|
||||||
|
SpinBox
|
||||||
{
|
{
|
||||||
acceptedButtons: Qt.AllButtons;
|
id: spinBox
|
||||||
anchors.fill: parent;
|
|
||||||
enabled: parent.readOnly;
|
enabled: !base.readOnly
|
||||||
onWheel: wheel.accepted = true;
|
opacity: base.readOnly ? 0.5 : 1.0
|
||||||
cursorShape: enabled ? Qt.ArrowCursor : Qt.IBeamCursor;
|
|
||||||
|
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 }
|
||||||
}
|
}
|
||||||
|
|
46
resources/qml/Preferences/ReadOnlyTextArea.qml
Normal file
46
resources/qml/Preferences/ReadOnlyTextArea.qml
Normal 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 }
|
||||||
|
}
|
46
resources/qml/Preferences/ReadOnlyTextField.qml
Normal file
46
resources/qml/Preferences/ReadOnlyTextField.qml
Normal 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 }
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue