Browse Source

Merge pull request #8658 from mavlink/PopupDialogFlickable

Fix QGCPopupDialog automatic flickable parenting
QGC4.4
Don Gagne 5 years ago committed by GitHub
parent
commit
1c4e225292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/FlightMap/Widgets/ValuePageWidget.qml
  2. 30
      src/QmlControls/QGCPopupDialogContainer.qml

2
src/FlightMap/Widgets/ValuePageWidget.qml

@ -545,7 +545,7 @@ Column { @@ -545,7 +545,7 @@ Column {
ColorDialog {
id: colorPickerDialog
modality: Qt.ApplicationModal
currentColor: instrumentValue.rangeColors[colorIndex]
currentColor: instrumentValue.rangeColors.length ? instrumentValue.rangeColors[colorIndex] : "white"
onAccepted: updateColorValue(colorIndex, color)
property int colorIndex: 0

30
src/QmlControls/QGCPopupDialogContainer.qml

@ -23,8 +23,8 @@ Popup { @@ -23,8 +23,8 @@ Popup {
id: popupRoot
anchors.centerIn: parent
width: mainFlickable.width + (padding * 2)
height: mainFlickable.height + (padding * 2)
width: mainColumnLayout.width + (padding * 2)
height: mainColumnLayout.y + mainColumnLayout.height + padding
padding: 2
modal: true
focus: true
@ -34,8 +34,8 @@ Popup { @@ -34,8 +34,8 @@ Popup {
property string _dialogTitle
property real _contentMargin: ScreenTools.defaultFontPixelHeight / 2
property real _popupDoubleInset: ScreenTools.defaultFontPixelHeight * 2
property real _maxAvailableWidth: parent.width - _popupDoubleInset
property real _maxAvailableHeight: parent.height - _popupDoubleInset
property real _maxContentWidth: parent.width - _popupDoubleInset
property real _maxContentHeight: parent.height - titleRowLayout.height - _popupDoubleInset
background: Item {
Rectangle {
@ -160,13 +160,6 @@ Popup { @@ -160,13 +160,6 @@ Popup {
onHideDialog: close()
}
QGCFlickable {
id: mainFlickable
width: Math.min(mainColumnLayout.width, _maxAvailableWidth)
height: Math.min(mainColumnLayout.height, _maxAvailableHeight)
contentWidth: mainColumnLayout.width
contentHeight: mainColumnLayout.height
Rectangle {
width: titleRowLayout.width
height: titleRowLayout.height
@ -184,7 +177,7 @@ Popup { @@ -184,7 +177,7 @@ Popup {
QGCLabel {
Layout.leftMargin: ScreenTools.defaultFontPixelWidth
Layout.fillWidth: true
text: title
text: _dialogTitle
height: parent.height
verticalAlignment: Text.AlignVCenter
}
@ -201,10 +194,17 @@ Popup { @@ -201,10 +194,17 @@ Popup {
}
}
QGCFlickable {
id: mainFlickable
Layout.preferredWidth: Math.min(marginItem.width, _maxContentWidth)
Layout.preferredHeight: Math.min(marginItem.height, _maxContentHeight)
contentWidth: marginItem.width
contentHeight: marginItem.height
Item {
id: item
Layout.preferredWidth: dialogComponentLoader.width + (_contentMargin * 2)
Layout.preferredHeight: dialogComponentLoader.height + _contentMargin
id: marginItem
width: dialogComponentLoader.width + (_contentMargin * 2)
height: dialogComponentLoader.height + _contentMargin
Loader {
id: dialogComponentLoader

Loading…
Cancel
Save