From a0e87e458b5af22a81a87f6fe5f3e0775ed8b697 Mon Sep 17 00:00:00 2001 From: Ali Kianian Date: Mon, 17 Oct 2022 10:35:20 +0300 Subject: [PATCH] Sections could be non-collapsible A property named collapsible is considered for Sections. The default value is true for this property. The section would be affected by the user collapse request if the collapsible is true (Single collapse by clicking, and colapseAll request). Otherwise, the section will not be affected by user requests. Task-number: QDS-7527 Change-Id: Ic4c9d0489d4b8c9ec90a0c71c755fa4c52935d39 Reviewed-by: Miikka Heikkinen Reviewed-by: Mahmoud Badri --- .../MaterialEditorTopSection.qml | 1 + .../imports/HelperWidgets/Section.qml | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/share/qtcreator/qmldesigner/materialEditorQmlSources/MaterialEditorTopSection.qml b/share/qtcreator/qmldesigner/materialEditorQmlSources/MaterialEditorTopSection.qml index afc4be51866..6aaad4eaa13 100644 --- a/share/qtcreator/qmldesigner/materialEditorQmlSources/MaterialEditorTopSection.qml +++ b/share/qtcreator/qmldesigner/materialEditorQmlSources/MaterialEditorTopSection.qml @@ -197,6 +197,7 @@ Column { // Section with hidden header is used so properties are aligned with the other sections' properties hideHeader: true width: parent.width + collapsible: false SectionLayout { PropertyLabel { text: qsTr("Name") } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml index 143ec349d04..69cf7c77953 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml @@ -51,6 +51,7 @@ Item { property int level: 0 property int levelShift: 10 property bool hideHeader: false + property bool collapsible: true property bool expandOnClick: true // if false, toggleExpand signal will be emitted instead property bool addTopPadding: true property bool addBottomPadding: true @@ -70,7 +71,10 @@ Item { Connections { target: Controller - function onCollapseAll() { section.expanded = false } + function onCollapseAll() { + if (collapsible) + section.expanded = false + } function onExpandAll() { section.expanded = true } } @@ -142,6 +146,9 @@ Item { acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: function(mouse) { if (mouse.button === Qt.LeftButton) { + if (!section.collapsible && section.expanded) + return + transition.enabled = true if (section.expandOnClick) section.expanded = !section.expanded