diff options
author | Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> | 2014-10-13 10:21:20 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> | 2014-10-13 10:33:10 +0300 |
commit | 732c9f39f08d7867c8e127c84d319ae514d682fd (patch) | |
tree | acb14a3dbe2cb98e154c28b6845b83c687abb752 /tests | |
parent | 8ff6a5d6d89d80707dc07fc96e22160fa1f8e973 (diff) |
Fix context cleanup
Context was not getting properly cleaned up in cases where
render thread stopped before the cleanup took place.
Now we ensure that required cleanup is done before context
thread terminates.
Change-Id: I1489914dafec928eebb69bac737f6f858ff49432
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qmlmultiwindow/qml/qmlmultiwindow/main.qml | 120 |
1 files changed, 58 insertions, 62 deletions
diff --git a/tests/qmlmultiwindow/qml/qmlmultiwindow/main.qml b/tests/qmlmultiwindow/qml/qmlmultiwindow/main.qml index 7dfe0bec..57d62019 100644 --- a/tests/qmlmultiwindow/qml/qmlmultiwindow/main.qml +++ b/tests/qmlmultiwindow/qml/qmlmultiwindow/main.qml @@ -31,19 +31,51 @@ Rectangle { id: data } - Window { - id: firstWindow - x: 100 - y: 100 - width: 500 - height: 500 - visible: true - Rectangle { - id: firstRect - color: "red" - anchors.fill: parent - } - } + property QtObject surfaceWindowObject; + property string surfaceWindowStr: + "\n + import QtQuick 2.1\n + import QtQuick.Window 2.1\n + import QtQuick.Layouts 1.0\n + import QtDataVisualization 1.0\n + import \".\"\n + Window {\n + Data {\n + id: data\n + }\n + id: firstWindow\n + x: 100\n + y: 100\n + width: 500\n + height: 500\n + visible: true\n + Rectangle {\n + id: firstRect\n + color: \"red\"\n + anchors.fill: parent\n + Surface3D {\n + id: surfaceGraph\n + anchors.fill: parent\n + anchors.margins: parent.border.width\n + theme: Theme3D {\n + type: Theme3D.ThemePrimaryColors\n + font.pointSize: 60\n + }\n + scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh\n + Surface3DSeries {\n + itemLabelFormat: \"Pop density at (@xLabel N, @zLabel E): @yLabel\"\n + ItemModelSurfaceDataProxy {\n + itemModel: data.myData\n + rowRole: \"row\"\n + columnRole: \"col\"\n + xPosRole: \"latitude\"\n + zPosRole: \"longitude\"\n + yPosRole: \"pop_density\"\n + }\n + }\n + }\n + }\n + }" Window { id: secondWindow @@ -59,19 +91,6 @@ Rectangle { } } - states: [ - State { - name: "firstWindow" - ParentChange { target: surfaceGraph; parent: firstRect; x: 0; y: 0 } - }, - State { - name: "secondWindow" - ParentChange { target: surfaceGraph; parent: secondRect; x: 0; y: 0 } - } - ] - - state: "firstWindow" - //! [0] GridLayout { id: gridLayout @@ -86,32 +105,18 @@ Rectangle { Rectangle { Layout.fillHeight: true Layout.fillWidth: true - border.color: surfaceGraph.theme.gridLineColor border.width: 2 + } - Surface3D { - id: surfaceGraph - anchors.fill: parent - anchors.margins: parent.border.width - theme: Theme3D { - type: Theme3D.ThemePrimaryColors - font.pointSize: 60 - } - scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeftHigh - - Surface3DSeries { - itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel" - ItemModelSurfaceDataProxy { - itemModel: data.myData - // The surface data points are not neatly lined up in rows and columns, - // so we define explicit row and column roles. - rowRole: "row" - columnRole: "col" - xPosRole: "latitude" - zPosRole: "longitude" - yPosRole: "pop_density" - } - } + Timer { + id: windowToggleTimer + interval: 1000 + running: false + repeat: false + onTriggered: { + if (surfaceWindowObject != null) + surfaceWindowObject.destroy() + surfaceWindowObject = Qt.createQmlObject(surfaceWindowStr, mainView) } } @@ -131,13 +136,10 @@ Rectangle { Layout.minimumWidth: parent.width / 2 Layout.fillHeight: true Layout.fillWidth: true - text: "Move graph between windows" + text: "(re)construct surface window in a loop" onClicked: { - if (mainView.state === "firstWindow") { - mainView.state = "secondWindow" - } else { - mainView.state = "firstWindow" - } + windowToggleTimer.running = true + windowToggleTimer.repeat = true } } @@ -231,14 +233,11 @@ Rectangle { function clearSelections() { barGraph.clearSelection() scatterGraph.clearSelection() - surfaceGraph.clearSelection() } function resetCameras() { - surfaceGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetIsometricLeftHigh scatterGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetIsometricLeftHigh barGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetIsometricLeftHigh - surfaceGraph.scene.activeCamera.zoomLevel = 100.0 scatterGraph.scene.activeCamera.zoomLevel = 100.0 barGraph.scene.activeCamera.zoomLevel = 100.0 } @@ -246,12 +245,9 @@ Rectangle { function toggleMeshStyle() { if (barGraph.seriesList[0].meshSmooth === true) { barGraph.seriesList[0].meshSmooth = false - if (surfaceGraph.seriesList[0].flatShadingSupported) - surfaceGraph.seriesList[0].flatShadingEnabled = true scatterGraph.seriesList[0].meshSmooth = false } else { barGraph.seriesList[0].meshSmooth = true - surfaceGraph.seriesList[0].flatShadingEnabled = false scatterGraph.seriesList[0].meshSmooth = true } } |