forked from qt-creator/qt-creator
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:
@@ -197,6 +197,7 @@ Column {
|
|||||||
// Section with hidden header is used so properties are aligned with the other sections' properties
|
// Section with hidden header is used so properties are aligned with the other sections' properties
|
||||||
hideHeader: true
|
hideHeader: true
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
collapsible: false
|
||||||
|
|
||||||
SectionLayout {
|
SectionLayout {
|
||||||
PropertyLabel { text: qsTr("Name") }
|
PropertyLabel { text: qsTr("Name") }
|
||||||
|
@@ -51,6 +51,7 @@ Item {
|
|||||||
property int level: 0
|
property int level: 0
|
||||||
property int levelShift: 10
|
property int levelShift: 10
|
||||||
property bool hideHeader: false
|
property bool hideHeader: false
|
||||||
|
property bool collapsible: true
|
||||||
property bool expandOnClick: true // if false, toggleExpand signal will be emitted instead
|
property bool expandOnClick: true // if false, toggleExpand signal will be emitted instead
|
||||||
property bool addTopPadding: true
|
property bool addTopPadding: true
|
||||||
property bool addBottomPadding: true
|
property bool addBottomPadding: true
|
||||||
@@ -70,7 +71,10 @@ Item {
|
|||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Controller
|
target: Controller
|
||||||
function onCollapseAll() { section.expanded = false }
|
function onCollapseAll() {
|
||||||
|
if (collapsible)
|
||||||
|
section.expanded = false
|
||||||
|
}
|
||||||
function onExpandAll() { section.expanded = true }
|
function onExpandAll() { section.expanded = true }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +146,9 @@ Item {
|
|||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: function(mouse) {
|
onClicked: function(mouse) {
|
||||||
if (mouse.button === Qt.LeftButton) {
|
if (mouse.button === Qt.LeftButton) {
|
||||||
|
if (!section.collapsible && section.expanded)
|
||||||
|
return
|
||||||
|
|
||||||
transition.enabled = true
|
transition.enabled = true
|
||||||
if (section.expandOnClick)
|
if (section.expandOnClick)
|
||||||
section.expanded = !section.expanded
|
section.expanded = !section.expanded
|
||||||
|
Reference in New Issue
Block a user