2023-02-03 14:58:01 +01:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
2023-01-04 08:52:22 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2022-03-18 17:28:28 +02:00
|
|
|
|
2023-02-03 14:58:01 +01:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Layouts
|
2024-01-16 12:30:29 +01:00
|
|
|
import HelperWidgets as HelperWidgets
|
|
|
|
|
import StudioControls as StudioControls
|
|
|
|
|
import StudioTheme as StudioTheme
|
2022-03-18 17:28:28 +02:00
|
|
|
|
2024-06-10 13:24:52 +03:00
|
|
|
StudioControls.SplitView {
|
2022-03-18 17:28:28 +02:00
|
|
|
id: root
|
|
|
|
|
|
2024-06-10 13:24:52 +03:00
|
|
|
property alias showImage: previewLoader.active
|
|
|
|
|
property Component previewComponent: null
|
2024-05-28 09:28:21 +03:00
|
|
|
|
2024-06-10 13:24:52 +03:00
|
|
|
width: parent.width
|
|
|
|
|
implicitHeight: showImage ? previewLoader.implicitHeight + nameSection.implicitHeight : nameSection.implicitHeight
|
2024-06-06 11:56:19 +03:00
|
|
|
|
|
|
|
|
orientation: Qt.Vertical
|
|
|
|
|
|
2024-06-10 13:24:52 +03:00
|
|
|
Loader {
|
|
|
|
|
id: previewLoader
|
2024-06-03 12:38:03 +03:00
|
|
|
|
2024-06-06 11:56:19 +03:00
|
|
|
SplitView.fillWidth: true
|
|
|
|
|
SplitView.minimumWidth: 152
|
2024-06-10 13:24:52 +03:00
|
|
|
SplitView.preferredHeight: previewLoader.visible ? Math.min(root.width * 0.75, 400) : 0
|
|
|
|
|
SplitView.minimumHeight: previewLoader.visible ? 150 : 0
|
|
|
|
|
SplitView.maximumHeight: previewLoader.visible ? 600 : 0
|
2024-06-06 11:56:19 +03:00
|
|
|
|
2024-06-10 13:24:52 +03:00
|
|
|
visible: previewLoader.active && previewLoader.item
|
2024-06-06 11:56:19 +03:00
|
|
|
|
2024-06-10 13:24:52 +03:00
|
|
|
sourceComponent: root.previewComponent
|
2022-03-18 17:28:28 +02:00
|
|
|
}
|
|
|
|
|
|
2023-02-03 14:58:01 +01:00
|
|
|
HelperWidgets.Section {
|
2024-06-06 11:56:19 +03:00
|
|
|
id: nameSection
|
|
|
|
|
|
2022-03-18 17:28:28 +02:00
|
|
|
// Section with hidden header is used so properties are aligned with the other sections' properties
|
|
|
|
|
hideHeader: true
|
2024-06-06 11:56:19 +03:00
|
|
|
SplitView.fillWidth: true
|
|
|
|
|
SplitView.preferredHeight: implicitHeight
|
|
|
|
|
SplitView.maximumHeight: implicitHeight
|
|
|
|
|
bottomPadding: StudioTheme.Values.sectionPadding * 2
|
2022-10-17 10:35:20 +03:00
|
|
|
collapsible: false
|
2022-03-18 17:28:28 +02:00
|
|
|
|
2023-02-03 14:58:01 +01:00
|
|
|
HelperWidgets.SectionLayout {
|
|
|
|
|
HelperWidgets.PropertyLabel { text: qsTr("Name") }
|
2022-03-18 17:28:28 +02:00
|
|
|
|
2023-02-03 14:58:01 +01:00
|
|
|
HelperWidgets.SecondColumnLayout {
|
|
|
|
|
HelperWidgets.Spacer { implicitWidth: StudioTheme.Values.actionIndicatorWidth }
|
2022-03-18 17:28:28 +02:00
|
|
|
|
2023-02-03 14:58:01 +01:00
|
|
|
HelperWidgets.LineEdit {
|
2022-03-18 17:28:28 +02:00
|
|
|
implicitWidth: StudioTheme.Values.singleControlColumnWidth
|
|
|
|
|
width: StudioTheme.Values.singleControlColumnWidth
|
|
|
|
|
backendValue: backendValues.objectName
|
|
|
|
|
placeholderText: qsTr("Material name")
|
|
|
|
|
|
|
|
|
|
text: backendValues.id.value
|
|
|
|
|
showTranslateCheckBox: false
|
|
|
|
|
showExtendedFunctionButton: false
|
|
|
|
|
|
|
|
|
|
// allow only alphanumeric characters, underscores, no space at start, and 1 space between words
|
2024-06-06 11:56:19 +03:00
|
|
|
validator: RegularExpressionValidator { regularExpression: /^(\w+\s)*\w+$/ }
|
2022-03-18 17:28:28 +02:00
|
|
|
}
|
|
|
|
|
|
2023-02-03 14:58:01 +01:00
|
|
|
HelperWidgets.ExpandingSpacer {}
|
2022-03-18 17:28:28 +02:00
|
|
|
}
|
|
|
|
|
|
2023-02-03 14:58:01 +01:00
|
|
|
HelperWidgets.PropertyLabel { text: qsTr("Type") }
|
2022-03-18 17:28:28 +02:00
|
|
|
|
2023-02-03 14:58:01 +01:00
|
|
|
HelperWidgets.SecondColumnLayout {
|
2024-06-06 11:56:19 +03:00
|
|
|
HelperWidgets.Spacer { implicitWidth: StudioTheme.Values.actionIndicatorWidth }
|
2022-03-18 17:28:28 +02:00
|
|
|
|
2024-06-06 11:56:19 +03:00
|
|
|
HelperWidgets.ComboBox {
|
2022-08-12 12:47:21 +03:00
|
|
|
currentIndex: possibleTypeIndex
|
|
|
|
|
model: possibleTypes
|
2022-03-18 17:28:28 +02:00
|
|
|
showExtendedFunctionButton: false
|
|
|
|
|
implicitWidth: StudioTheme.Values.singleControlColumnWidth
|
2024-05-02 14:03:50 +03:00
|
|
|
enabled: possibleTypes.length > 1
|
2022-03-18 17:28:28 +02:00
|
|
|
|
|
|
|
|
onActivated: changeTypeName(currentValue)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|