diff options
author | Ali Kianian <ali.kianian@qt.io> | 2022-10-17 10:35:20 +0300 |
---|---|---|
committer | Ali Kianian <ali.kianian@qt.io> | 2022-10-18 06:22:55 +0000 |
commit | a0e87e458b5af22a81a87f6fe5f3e0775ed8b697 (patch) | |
tree | ccdfec87de235ff2308d3dd27f0192a85b1a67a6 | |
parent | bf45aa4d24f78396a98fa5e2fb4bb2261ee05355 (diff) |
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 <miikka.heikkinen@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
-rw-r--r-- | share/qtcreator/qmldesigner/materialEditorQmlSources/MaterialEditorTopSection.qml | 1 | ||||
-rw-r--r-- | share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/Section.qml | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/share/qtcreator/qmldesigner/materialEditorQmlSources/MaterialEditorTopSection.qml b/share/qtcreator/qmldesigner/materialEditorQmlSources/MaterialEditorTopSection.qml index afc4be5186..6aaad4eaa1 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 143ec349d0..69cf7c7795 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 |