diff options
Diffstat (limited to 'src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml')
-rw-r--r-- | src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml | 108 |
1 files changed, 90 insertions, 18 deletions
diff --git a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml index c291de7b..d5570fc7 100644 --- a/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml +++ b/src/Authoring/Qt3DStudio/Palettes/Inspector/InspectorControlView.qml @@ -192,7 +192,7 @@ Rectangle { property int indexOfThisDelegate: index - width: parent.width + width: groupElements.width height: items.height color: "transparent"; ListView.delayRemove: true @@ -263,6 +263,11 @@ Rectangle { _tabOrderHandler.addItem( indexOfThisDelegate, item.loadedItem.tabItem3) + if (item.loadedItem.tabItem4 !== undefined) { + _tabOrderHandler.addItem( + indexOfThisDelegate, + item.loadedItem.tabItem4) + } } } } @@ -280,9 +285,6 @@ Rectangle { coords.x, coords.y, model.modelData.handle, model.modelData.instance); - // Refresh text; title color is wrong after this - propertyRow.color = _parentView.titleColor( - modelData.instance, modelData.handle); } ColumnLayout { // Property row and datainput control @@ -332,7 +334,9 @@ Rectangle { } } StyledTooltip { - text: qsTr("Enable animation") + text: model.modelData.animated + ? qsTr("Disable animation") + : qsTr("Enable animation") enabled: animateButtonMouseArea.containsMouse } } @@ -372,7 +376,6 @@ Rectangle { + ctrldPropButton.width, ctrldPropButton.y + ctrldPropButton.height)); - } } @@ -391,11 +394,13 @@ Rectangle { readonly property var modelData: model.modelData text: model.modelData.title - // Color picked from DataInput icon - color: model.modelData.controlled? - _dataInputColor - : _parentView.titleColor(modelData.instance, - modelData.handle) + // Label is showing "controlled", "invalid data" or + // ordinary text color. + color: model.modelData.controlled + ? _dataInputColor : model.modelData.validData + ? _parentView.titleColor(modelData.instance, + modelData.handle) + : _invalidDataIndicatorColor Layout.alignment: Qt.AlignTop @@ -476,7 +481,7 @@ Rectangle { if (modelData.propertyType === AdditionalMetaDataType.Font) return fontDropDown; if (modelData.propertyType === AdditionalMetaDataType.Texture) - return textureChooser; + return imageChooser; if (modelData.propertyType === AdditionalMetaDataType.String) return editLine; if (modelData.propertyType === AdditionalMetaDataType.None) @@ -515,6 +520,8 @@ Rectangle { case DataModelDataType.Float4: if (modelData.propertyType === AdditionalMetaDataType.Color) return colorBox; + if (modelData.propertyType === AdditionalMetaDataType.None) + return xyzwPropertyComponent; return null; case DataModelDataType.StringRef: if (modelData.propertyType === AdditionalMetaDataType.None) @@ -539,13 +546,12 @@ Rectangle { } } - Column { + StyledLabel { visible: model.info.length > 0 - StyledLabel { - width: groupElements.width - horizontalAlignment: Text.AlignHCenter - text: model.info; - } + x: 42 + width: items.width - x - 10 + wrapMode: Text.WordWrap + text: model.info; } } } @@ -660,6 +666,54 @@ Rectangle { } Component { + id: xyzwPropertyComponent + + RowLayout { + property int instance: parent.modelData.instance + property int handle: parent.modelData.handle + property variant values: parent.modelData.values + property alias tabItem1: xyzwHandler.tabItem1 + property alias tabItem2: xyzwHandler.tabItem2 + property alias tabItem3: xyzwHandler.tabItem3 + property alias tabItem4: xyzwHandler.tabItem4 + spacing: 0 + + onValuesChanged: { + // FloatTextField can set its text internally, thus breaking the binding, so + // let's set the text value explicitly each time value changes + xyzwHandler.valueX = Number(values[0]).toFixed(xyzwHandler.numberOfDecimal); + xyzwHandler.valueY = Number(values[1]).toFixed(xyzwHandler.numberOfDecimal); + xyzwHandler.valueZ = Number(values[2]).toFixed(xyzwHandler.numberOfDecimal); + xyzwHandler.valueW = Number(values[3]).toFixed(xyzwHandler.numberOfDecimal); + } + + HandlerPropertyBaseXYZW { + id: xyzwHandler + valueX: Number(values[0]).toFixed(numberOfDecimal) + valueY: Number(values[1]).toFixed(numberOfDecimal) + valueZ: Number(values[2]).toFixed(numberOfDecimal) + valueW: Number(values[3]).toFixed(numberOfDecimal) + onEditingFinished: { + _inspectorModel.setPropertyValue(parent.instance, parent.handle, + Qt.vector4d(valueX, valueY, valueZ, valueW), + true); + } + onPreviewValueChanged: { + _inspectorModel.setPropertyValue(parent.instance, parent.handle, + Qt.vector4d(valueX, valueY, valueZ, valueW), + false); + } + onTriggerUndo: { + _inspectorModel.undo(); + } + onTriggerRedo: { + _inspectorModel.redo(); + } + } + } + } + + Component { id: xyzPropertyComponent RowLayout { @@ -692,6 +746,12 @@ Rectangle { _inspectorModel.setPropertyValue(parent.instance, parent.handle, Qt.vector3d(valueX, valueY, valueZ), false); } + onTriggerUndo: { + _inspectorModel.undo(); + } + onTriggerRedo: { + _inspectorModel.redo(); + } } } } @@ -726,6 +786,12 @@ Rectangle { _inspectorModel.setPropertyValue(parent.instance, parent.handle, Qt.vector2d(valueX, valueY), false); } + onTriggerUndo: { + _inspectorModel.undo(); + } + onTriggerRedo: { + _inspectorModel.redo(); + } } } } @@ -762,6 +828,12 @@ Rectangle { _inspectorModel.setPropertyValue(parent.instance, parent.handle, Number(text), true); } + onTriggerUndo: { + _inspectorModel.undo(); + } + onTriggerRedo: { + _inspectorModel.redo(); + } } } } |