Browse Source

Fix Analyze Page popup ownership

QGC4.4
Don Gagne 2 years ago committed by Don Gagne
parent
commit
aa7cdf96b9
  1. 39
      src/AnalyzeView/AnalyzeView.qml
  2. 38
      src/ui/MainRootWindow.qml

39
src/AnalyzeView/AnalyzeView.qml

@ -127,43 +127,8 @@ Rectangle { @@ -127,43 +127,8 @@ Rectangle {
property string title
Connections {
target: panelLoader.item
onPopout: {
var windowedPage = windowedAnalyzePage.createObject(mainWindow)
windowedPage.title = panelLoader.title
windowedPage.source = panelLoader.source
_root.popout()
}
}
}
Component {
id: windowedAnalyzePage
Window {
width: ScreenTools.defaultFontPixelWidth * 100
height: ScreenTools.defaultFontPixelHeight * 40
visible: true
property alias source: loader.source
Rectangle {
color: QGroundControl.globalPalette.window
anchors.fill: parent
Loader {
id: loader
anchors.fill: parent
onLoaded: item.popped = true
}
}
onClosing: {
visible = false
source = ""
}
target: panelLoader.item
onPopout: mainWindow.createrWindowedAnalyzePage(panelLoader.title, panelLoader.source)
}
}
}

38
src/ui/MainRootWindow.qml

@ -666,4 +666,42 @@ ApplicationWindow { @@ -666,4 +666,42 @@ ApplicationWindow {
indicatorPopup.currentIndicator = null
}
}
// We have to create the popup windows for the Analyze pages here so that the creation context is rooted
// to mainWindow. Otherwise if they are rooted to the AnalyzeView itself they will die when the analyze viewSwitch
// closes.
function createrWindowedAnalyzePage(title, source) {
var windowedPage = windowedAnalyzePage.createObject(mainWindow)
windowedPage.title = title
windowedPage.source = source
}
Component {
id: windowedAnalyzePage
Window {
width: ScreenTools.defaultFontPixelWidth * 100
height: ScreenTools.defaultFontPixelHeight * 40
visible: true
property alias source: loader.source
Rectangle {
color: QGroundControl.globalPalette.window
anchors.fill: parent
Loader {
id: loader
anchors.fill: parent
onLoaded: item.popped = true
}
}
onClosing: {
visible = false
source = ""
}
}
}
}

Loading…
Cancel
Save