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>
This commit is contained in:
Ali Kianian
2022-10-17 10:35:20 +03:00
parent bf45aa4d24
commit a0e87e458b
2 changed files with 9 additions and 1 deletions

View File

@@ -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") }

View File

@@ -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