mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 16:58:24 +02:00
[Viewer] Viewer2D: Load and unload SfmStats components explicitly
The SfmStatsView and SfmGlobalStats components used to be loaded once and for all with "Component.onCompleted". With the upgrade to Qt 5.14, it is needed to load and explicitly unload the component (by resetting its source) for the statistics to always be correctly displayed. Otherwise, they can be loaded and viewed only once per session; after being shown for the first time, they are set to null and never reloaded. This commit uses the same type of loading/unloading as all the other components in the 2D Viewer.
This commit is contained in:
parent
874c22946a
commit
15f963a9b5
1 changed files with 22 additions and 14 deletions
|
@ -876,13 +876,17 @@ FocusScope {
|
|||
anchors.fill: parent
|
||||
active: msfmDataLoader.status === Loader.Ready && displaySfmStatsView.checked
|
||||
|
||||
Component.onCompleted: {
|
||||
// instantiate and initialize a SfmStatsView component dynamically using Loader.setSource
|
||||
// so it can fail safely if the c++ plugin is not available
|
||||
setSource("SfmStatsView.qml", {
|
||||
'msfmData': Qt.binding(function() { return msfmDataLoader.item; }),
|
||||
'viewId': Qt.binding(function() { return _reconstruction.selectedViewId; }),
|
||||
})
|
||||
onActiveChanged: {
|
||||
// Load and unload the component explicitly
|
||||
// (necessary since Qt 5.14, Component.onCompleted cannot be used anymore to load the data once and for all)
|
||||
if (active) {
|
||||
setSource("SfmStatsView.qml", {
|
||||
"msfmData": Qt.binding(function() { return msfmDataLoader.item; }),
|
||||
"viewId": Qt.binding(function() { return _reconstruction.selectedViewId; }),
|
||||
})
|
||||
} else {
|
||||
setSource("", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
|
@ -890,14 +894,18 @@ FocusScope {
|
|||
anchors.fill: parent
|
||||
active: msfmDataLoader.status === Loader.Ready && displaySfmDataGlobalStats.checked
|
||||
|
||||
Component.onCompleted: {
|
||||
// instantiate and initialize a SfmStatsView component dynamically using Loader.setSource
|
||||
// so it can fail safely if the c++ plugin is not available
|
||||
setSource("SfmGlobalStats.qml", {
|
||||
'msfmData': Qt.binding(function() { return msfmDataLoader.item; }),
|
||||
'mTracks': Qt.binding(function() { return mtracksLoader.item; }),
|
||||
onActiveChanged: {
|
||||
// Load and unload the component explicitly
|
||||
// (necessary since Qt 5.14, Component.onCompleted cannot be used anymore to load the data once and for all)
|
||||
if (active) {
|
||||
setSource("SfmGlobalStats.qml", {
|
||||
'msfmData': Qt.binding(function() { return msfmDataLoader.item; }),
|
||||
'mTracks': Qt.binding(function() { return mtracksLoader.item; }),
|
||||
|
||||
})
|
||||
})
|
||||
} else {
|
||||
setSource("", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
Loader {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue