diff options
40 files changed, 1257 insertions, 782 deletions
diff --git a/.cmake.conf b/.cmake.conf index ac3b6f4a..e62fae5e 100644 --- a/.cmake.conf +++ b/.cmake.conf @@ -1,2 +1,2 @@ -set(QT_REPO_MODULE_VERSION "6.2.4") +set(QT_REPO_MODULE_VERSION "6.2.8") set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "") diff --git a/.qmake.conf b/.qmake.conf index 154c1919..c806b808 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -2,6 +2,6 @@ load(qt_build_config) DEFINES += QT_NO_JAVA_STYLE_ITERATORS -MODULE_VERSION = 6.2.4 +MODULE_VERSION = 6.2.8 CONFIG += warning_clean CMAKE_MODULE_TESTS=- diff --git a/coin/module_config.yaml b/coin/module_config.yaml index 7004c27d..8f0e6ef0 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -1,4 +1,5 @@ version: 2 +alias: qtdatavis3d accept_configuration: condition: property property: features @@ -13,6 +14,11 @@ instructions: instructions: - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" disable_if: - condition: property - property: configureArgs - contains_value: "-DFEATURE_widgets=OFF" + condition: or + conditions: + - condition: property + property: configureArgs + contains_value: "-DFEATURE_widgets=OFF" + - condition: property + property: configureArgs + contains_value: "-no-widgets" diff --git a/dependencies.yaml b/dependencies.yaml index 587129ba..91d92f71 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,10 +1,10 @@ dependencies: - ../qtbase: - ref: f99872ba5db54475cf0974b181dcdefb2acd8dad + ../tqtc-qtbase: + ref: 4c1c38dede55565afa846685b3e19cf8f1cfed0c required: true - ../qtdeclarative: - ref: 62c6002129f2dc9c72c6308cfdfbebe914751fbe + ../tqtc-qtdeclarative: + ref: 9919f58fce6329a233ca885188d0aba5f484e546 required: false - ../qtmultimedia: - ref: f0d9de2d3eb9fda682954cb88c2013bf2cfd7f5b + ../tqtc-qtmultimedia: + ref: 34dc084899419ab704703a888dbffe119566eaca required: false diff --git a/examples/datavisualization/qml3doscilloscope/qml/qml3doscilloscope/main.qml b/examples/datavisualization/qml3doscilloscope/qml/qml3doscilloscope/main.qml index 51eba416..89d5030d 100644 --- a/examples/datavisualization/qml3doscilloscope/qml/qml3doscilloscope/main.qml +++ b/examples/datavisualization/qml3doscilloscope/qml/qml3doscilloscope/main.qml @@ -28,9 +28,8 @@ ****************************************************************************/ import QtQuick -import QtQuick.Layouts import QtQuick.Controls -import QtDataVisualization 1.2 +import QtDataVisualization import "." Item { @@ -42,6 +41,8 @@ Item { property int sampleRows: sampleColumns / 2 property int sampleCache: 24 + property bool portraitMode: width < height + onSampleRowsChanged: { surfaceSeries.selectedPoint = surfaceSeries.invalidSelectionPosition generateData() @@ -51,7 +52,7 @@ Item { id: dataView anchors.bottom: parent.bottom width: parent.width - height: parent.height - buttonLayout.height + height: parent.height - controlArea.height Surface3D { id: surfaceGraph @@ -118,206 +119,175 @@ Item { //! [3] Rectangle { - width: parent.width - height: flatShadingToggle.implicitHeight * 2 + id: controlArea + height: portraitMode ? flatShadingToggle.implicitHeight * 7 + : flatShadingToggle.implicitHeight * 2 anchors.left: parent.left anchors.top: parent.top + anchors.right: parent.right color: surfaceGraph.theme.backgroundColor - ColumnLayout { - anchors.fill: parent - RowLayout { - id: sliderLayout - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumHeight: flatShadingToggle.implicitHeight - spacing: 0 - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: samplesText.implicitWidth + 120 - Layout.maximumWidth: samplesText.implicitWidth + 120 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - border.color: "gray" - border.width: 1 - radius: 4 - - RowLayout { - anchors.fill: parent - anchors.margins: parent.border.width + 1 - - Slider { - id: sampleSlider - Layout.fillHeight: true - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.minimumWidth: 80 - from: mainView.sampleCache * 2 - to: from * 10 - stepSize: mainView.sampleCache - Component.onCompleted: value = from * 2 - } - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: samplesText.implicitWidth + 10 - Layout.maximumWidth: samplesText.implicitWidth + 10 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - Text { - id: samplesText - text: "Samples: " + (mainView.sampleRows * mainView.sampleColumns) - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - } + // Samples + Rectangle { + id: samples + width: portraitMode ? mainView.width : mainView.width / 4 + height: flatShadingToggle.implicitHeight + anchors.left: parent.left + anchors.top: parent.top + + border.color: "gray" + border.width: 1 + radius: 4 + + Row { + anchors.centerIn: parent + spacing: 10 + padding: 5 + + Slider { + id: sampleSlider + from: mainView.sampleCache * 2 + to: from * 10 + stepSize: mainView.sampleCache + Component.onCompleted: value = from * 2 } - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: frequencyText.implicitWidth + 120 - Layout.maximumWidth: frequencyText.implicitWidth + 120 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - border.color: "gray" - border.width: 1 - radius: 4 - - RowLayout { - anchors.fill: parent - anchors.margins: parent.border.width + 1 - - Slider { - id: frequencySlider - Layout.fillHeight: true - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.minimumWidth: 80 - from: 2 - to: 60 - stepSize: 2 - value: 30 - } - - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: frequencyText.implicitWidth + 10 - Layout.maximumWidth: frequencyText.implicitWidth + 10 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - Text { - id: frequencyText - text: "Freq: " + frequencySlider.value + " Hz" - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } - } - } + Text { + id: samplesText + text: "Samples: " + (mainView.sampleRows * mainView.sampleColumns) + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter } + } + } - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: fpsText.implicitWidth + 10 - Layout.maximumWidth: fpsText.implicitWidth + 10 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - border.color: "gray" - border.width: 1 - radius: 4 - - Text { - id: fpsText - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - } + // Frequency + Rectangle { + id: frequency + width: portraitMode ? mainView.width : mainView.width / 4 + height: flatShadingToggle.implicitHeight + anchors.left: portraitMode ? parent.left : samples.right + anchors.top: portraitMode ? samples.bottom : parent.top + + border.color: "gray" + border.width: 1 + radius: 4 + + Row { + anchors.centerIn: parent + spacing: 10 + padding: 5 + + Slider { + id: frequencySlider + from: 2 + to: 60 + stepSize: 2 + value: 30 } - Rectangle { - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumWidth: selectionText.implicitWidth + 10 - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - - border.color: "gray" - border.width: 1 - radius: 4 - - Text { - id: selectionText - anchors.fill: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - text: "No selection" - } + Text { + id: frequencyText + text: "Freq: " + frequencySlider.value + " Hz" + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter } } + } - RowLayout { - id: buttonLayout - Layout.fillHeight: true - Layout.fillWidth: true - Layout.minimumHeight: flatShadingToggle.implicitHeight - spacing: 0 - - Button { - id: flatShadingToggle - Layout.fillHeight: true - Layout.fillWidth: true - - text: surfaceSeries.flatShadingSupported ? "Show Flat" : "Flat not supported" - enabled: surfaceSeries.flatShadingSupported - - onClicked: { - if (surfaceSeries.flatShadingEnabled === true) { - surfaceSeries.flatShadingEnabled = false; - text = "Show Flat" - } else { - surfaceSeries.flatShadingEnabled = true; - text = "Show Smooth" - } - } - } - - Button { - id: surfaceGridToggle - Layout.fillHeight: true - Layout.fillWidth: true - - text: "Show Surface Grid" - - onClicked: { - if (surfaceSeries.drawMode & Surface3DSeries.DrawWireframe) { - surfaceSeries.drawMode &= ~Surface3DSeries.DrawWireframe; - text = "Show Surface Grid" - } else { - surfaceSeries.drawMode |= Surface3DSeries.DrawWireframe; - text = "Hide Surface Grid" - } - } - } + // FPS + Rectangle { + id: fpsindicator + width: portraitMode ? mainView.width : mainView.width / 4 + height: flatShadingToggle.implicitHeight + anchors.left: portraitMode ? parent.left : frequency.right + anchors.top: portraitMode ? frequency.bottom : parent.top + + border.color: "gray" + border.width: 1 + radius: 4 + + Text { + id: fpsText + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + } + } - Button { - id: exitButton - Layout.fillHeight: true - Layout.fillWidth: true + // Selection + Rectangle { + id: selection + width: portraitMode ? mainView.width : mainView.width / 4 + height: flatShadingToggle.implicitHeight + anchors.left: portraitMode ? parent.left : fpsindicator.right + anchors.top: portraitMode ? fpsindicator.bottom : parent.top + + border.color: "gray" + border.width: 1 + radius: 4 + + Text { + id: selectionText + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + text: "No selection" + } + } - text: "Quit" + // Flat shading + Button { + id: flatShadingToggle + width: portraitMode ? mainView.width : mainView.width / 3 + anchors.left: parent.left + anchors.top: selection.bottom + + text: surfaceSeries.flatShadingSupported ? "Show Flat" : "Flat not supported" + enabled: surfaceSeries.flatShadingSupported + + onClicked: { + if (surfaceSeries.flatShadingEnabled === true) { + surfaceSeries.flatShadingEnabled = false; + text = "Show Flat" + } else { + surfaceSeries.flatShadingEnabled = true; + text = "Show Smooth" + } + } + } - onClicked: Qt.quit(); + // Surface grid + Button { + id: surfaceGridToggle + width: portraitMode ? mainView.width : mainView.width / 3 + anchors.left: portraitMode ? parent.left : flatShadingToggle.right + anchors.top: portraitMode ? flatShadingToggle.bottom : selection.bottom + + text: "Show Surface Grid" + + onClicked: { + if (surfaceSeries.drawMode & Surface3DSeries.DrawWireframe) { + surfaceSeries.drawMode &= ~Surface3DSeries.DrawWireframe; + text = "Show Surface Grid" + } else { + surfaceSeries.drawMode |= Surface3DSeries.DrawWireframe; + text = "Hide Surface Grid" } } } + // Exit + Button { + id: exitButton + width: portraitMode ? mainView.width : mainView.width / 3 + anchors.left: portraitMode ? parent.left : surfaceGridToggle.right + anchors.top: portraitMode ? surfaceGridToggle.bottom : selection.bottom + + text: "Quit" + + onClicked: Qt.quit(); + } } //! [4] diff --git a/examples/datavisualization/qmlaxisdrag/qml/qmlaxisdrag/main.qml b/examples/datavisualization/qmlaxisdrag/qml/qmlaxisdrag/main.qml index ac4cbd85..b500e412 100644 --- a/examples/datavisualization/qmlaxisdrag/qml/qmlaxisdrag/main.qml +++ b/examples/datavisualization/qmlaxisdrag/qml/qmlaxisdrag/main.qml @@ -28,7 +28,7 @@ ****************************************************************************/ import QtQuick -import QtDataVisualization 1.1 +import QtDataVisualization import QtQuick.Controls import "." @@ -45,6 +45,8 @@ Item { property int previousMouseX: -1 property int previousMouseY: -1 + property bool portraitMode: width < height + ListModel { id: graphModel ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0; rotation: "@0,0,0,0" } @@ -87,7 +89,7 @@ Item { } } else { graphModel.remove(2, 10); - if (graphModel.count == 2) { + if (graphModel.count === 2) { scatterGraph.theme = dynamicColorTheme isIncreasing = true } @@ -273,9 +275,11 @@ Item { Button { id: rangeToggle - width: parent.width / 3 // We're adding 3 buttons and want to divide them equally + // We're adding 3 buttons and want to divide them equally, if not in portrait mode + width: portraitMode ? parent.width : parent.width / 3 text: "Use Preset Range" anchors.left: parent.left + anchors.top: parent.top property bool autoRange: true onClicked: { if (autoRange) { @@ -302,9 +306,10 @@ Item { //! [8] Button { id: orthoToggle - width: parent.width / 3 + width: portraitMode ? parent.width : parent.width / 3 text: "Display Orthographic" - anchors.left: rangeToggle.right + anchors.left: portraitMode ? parent.left : rangeToggle.right + anchors.top: portraitMode ? rangeToggle.bottom : parent.top onClicked: { if (scatterGraph.orthoProjection) { text = "Display Orthographic"; @@ -321,9 +326,10 @@ Item { Button { id: exitButton - width: parent.width / 3 + width: portraitMode ? parent.width : parent.width / 3 text: "Quit" - anchors.left: orthoToggle.right + anchors.left: portraitMode ? parent.left : orthoToggle.right + anchors.top: portraitMode ? orthoToggle.bottom : parent.top onClicked: Qt.quit(); } } diff --git a/examples/datavisualization/qmlbars/qml/qmlbars/main.qml b/examples/datavisualization/qmlbars/qml/qmlbars/main.qml index 76eff0f2..dfebf1b1 100644 --- a/examples/datavisualization/qmlbars/qml/qmlbars/main.qml +++ b/examples/datavisualization/qmlbars/qml/qmlbars/main.qml @@ -63,7 +63,7 @@ Item { // Set tableView current row to selected bar var rowRole = series.dataProxy.rowLabels[position.x]; var colRole - if (barGraph.columnAxis === graphAxes.total) + if (barGraph.columnAxis == graphAxes.total) colRole = "01"; else colRole = series.dataProxy.columnLabels[position.y]; @@ -83,13 +83,12 @@ Item { Item { id: dataView - anchors.right: mainview.right; + anchors.right: mainview.right anchors.bottom: mainview.bottom Bars3D { id: barGraph - width: dataView.width - height: dataView.height + anchors.fill: parent shadowQuality: AbstractGraph3D.ShadowQualityMedium selectionMode: AbstractGraph3D.SelectionItem theme: Theme3D { @@ -176,12 +175,9 @@ Item { } } - - ColumnLayout { id: tableViewLayout - anchors.top: parent.top anchors.left: parent.left @@ -195,7 +191,6 @@ Item { padding: 3 text: header.columnNames[index] } - } TableView { @@ -215,7 +210,6 @@ Item { rows: graphData.modelAsJsArray } - delegate: Rectangle { implicitHeight: 30 implicitWidth: tableView.width / 3 @@ -245,7 +239,6 @@ Item { return display } } - } } } @@ -258,7 +251,7 @@ Item { var matches = pattern.exec(timestamp) var rowIndex = modelProxy.rowCategoryIndex(matches[1]) var colIndex - if (barGraph.columnAxis === graphAxes.total) + if (barGraph.columnAxis == graphAxes.total) colIndex = 0 // Just one column when showing yearly totals else colIndex = modelProxy.columnCategoryIndex(matches[2]) @@ -388,7 +381,7 @@ Item { name: "portrait" PropertyChanges { target: dataView - width: mainview.height / 4 * 3 + width: mainview.width height: mainview.width } PropertyChanges { diff --git a/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml b/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml index 77576127..8bd906fd 100644 --- a/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml +++ b/examples/datavisualization/qmlcustominput/qml/qmlcustominput/main.qml @@ -38,6 +38,8 @@ Item { width: 1280 height: 720 + property bool portraitMode: width < height + Data { id: graphData } @@ -46,7 +48,7 @@ Item { id: dataView anchors.bottom: parent.bottom width: parent.width - height: parent.height - buttonLayout.height + height: parent.height - (portraitMode ? shadowToggle.height * 3 : shadowToggle.height) //! [0] Scatter3D { @@ -191,54 +193,50 @@ Item { } //! [7] - RowLayout { - id: buttonLayout - Layout.minimumHeight: shadowToggle.height - width: parent.width + + Button { + id: shadowToggle + width: portraitMode ? parent.width : parent.width / 3 anchors.left: parent.left - spacing: 0 - - Button { - id: shadowToggle - Layout.fillHeight: true - Layout.minimumWidth: parent.width / 3 // 3 buttons divided equally in the layout - text: scatterGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" - enabled: scatterGraph.shadowsSupported - - onClicked: { - if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityMedium; - text = "Hide Shadows"; - } else { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; - text = "Show Shadows"; - } + anchors.top: parent.top + text: scatterGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" + enabled: scatterGraph.shadowsSupported + + onClicked: { + if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityMedium; + text = "Hide Shadows"; + } else { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; + text = "Show Shadows"; } } + } - Button { - id: cameraToggle - Layout.fillHeight: true - Layout.minimumWidth: parent.width / 3 - text: "Pause Camera" - - onClicked: { - cameraAnimationX.paused = !cameraAnimationX.paused; - cameraAnimationY.paused = cameraAnimationX.paused; - if (cameraAnimationX.paused) { - text = "Animate Camera"; - } else { - text = "Pause Camera"; - } + Button { + id: cameraToggle + width: portraitMode ? parent.width : parent.width / 3 + anchors.left: portraitMode ? parent.left : shadowToggle.right + anchors.top: portraitMode ? shadowToggle.bottom : parent.top + text: "Pause Camera" + + onClicked: { + cameraAnimationX.paused = !cameraAnimationX.paused; + cameraAnimationY.paused = cameraAnimationX.paused; + if (cameraAnimationX.paused) { + text = "Animate Camera"; + } else { + text = "Pause Camera"; } } + } - Button { - id: exitButton - Layout.fillHeight: true - Layout.minimumWidth: parent.width / 3 - text: "Quit" - onClicked: Qt.quit(); - } + Button { + id: exitButton + width: portraitMode ? parent.width : parent.width / 3 + anchors.left: portraitMode ? parent.left : cameraToggle.right + anchors.top: portraitMode ? cameraToggle.bottom : parent.top + text: "Quit" + onClicked: Qt.quit(); } } diff --git a/examples/datavisualization/qmlmultigraph/qml/qmlmultigraph/main.qml b/examples/datavisualization/qmlmultigraph/qml/qmlmultigraph/main.qml index f30b1739..219f22d4 100644 --- a/examples/datavisualization/qmlmultigraph/qml/qmlmultigraph/main.qml +++ b/examples/datavisualization/qmlmultigraph/qml/qmlmultigraph/main.qml @@ -38,6 +38,8 @@ Item { width: 800 height: 600 + property bool portratiMode: width < height + Data { id: data } @@ -102,7 +104,7 @@ Item { Layout.minimumWidth: parent.width / 2 Layout.fillHeight: true Layout.fillWidth: true - text: "Clear Selections" + text: portratiMode ? "Clear\nSelections" : "Clear Selections" onClicked: clearSelections() // call a helper function to keep button itself simpler } @@ -117,14 +119,14 @@ Item { Button { Layout.fillHeight: true Layout.fillWidth: true - text: "Reset Cameras" + text: portratiMode ? "Reset\nCameras" : "Reset Cameras" onClicked: resetCameras() // call a helper function to keep button itself simpler } Button { Layout.fillHeight: true Layout.fillWidth: true - text: "Toggle Mesh Styles" + text: portratiMode ? "Toggle\nMesh\nStyles" : "Toggle Mesh Styles" onClicked: toggleMeshStyle() // call a helper function to keep button itself simpler } } diff --git a/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml b/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml index a64538da..97f5082a 100644 --- a/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml +++ b/examples/datavisualization/qmlscatter/qml/qmlscatter/main.qml @@ -29,9 +29,8 @@ //! [0] import QtQuick -import QtQuick.Layouts import QtQuick.Controls -import QtDataVisualization 1.2 +import QtDataVisualization import "." //! [0] @@ -42,6 +41,8 @@ Item { width: 500 height: 500 + property bool portraitMode: width < height + //! [4] Data { id: seriesData @@ -68,7 +69,8 @@ Item { anchors.bottom: parent.bottom //! [9] width: parent.width - height: parent.height - buttonLayout.height + height: parent.height - (portraitMode ? shadowToggle.implicitHeight * 3 + 25 + : shadowToggle.implicitHeight + 10) //! [8] //! [2] @@ -141,103 +143,108 @@ Item { } } - RowLayout { - id: buttonLayout - Layout.minimumHeight: cameraToggle.height - width: parent.width + //! [7] + Button { + id: shadowToggle + width: portraitMode ? implicitWidth : (mainView.width / 6 - 6) anchors.left: parent.left - spacing: 0 - //! [7] - Button { - id: shadowToggle - Layout.fillHeight: true - Layout.fillWidth: true - text: scatterGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" - enabled: scatterGraph.shadowsSupported - onClicked: { - if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualitySoftLow; - text = "Hide Shadows"; - } else { - scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; - text = "Show Shadows"; - } + anchors.top: parent.top + anchors.margins: 5 + text: scatterGraph.shadowsSupported ? "Hide Shadows" : "Shadows not supported" + enabled: scatterGraph.shadowsSupported + onClicked: { + if (scatterGraph.shadowQuality === AbstractGraph3D.ShadowQualityNone) { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualitySoftLow; + text = "Hide Shadows"; + } else { + scatterGraph.shadowQuality = AbstractGraph3D.ShadowQualityNone; + text = "Show Shadows"; } } - //! [7] - - Button { - id: smoothToggle - Layout.fillHeight: true - Layout.fillWidth: true - text: "Use Smooth for Series One" - onClicked: { - if (scatterSeries.meshSmooth === false) { - text = "Use Flat for Series One"; - scatterSeries.meshSmooth = true; - } else { - text = "Use Smooth for Series One" - scatterSeries.meshSmooth = false; - } + } + //! [7] + + Button { + id: smoothToggle + width: portraitMode ? implicitWidth : (mainView.width / 6 - 6) + anchors.left: shadowToggle.right + anchors.top: parent.top + anchors.margins: 5 + text: "Use Smooth for Series One" + onClicked: { + if (scatterSeries.meshSmooth === false) { + text = "Use Flat for Series One"; + scatterSeries.meshSmooth = true; + } else { + text = "Use Smooth for Series One" + scatterSeries.meshSmooth = false; } } + } - Button { - id: cameraToggle - Layout.fillHeight: true - Layout.fillWidth: true - text: "Change Camera Placement" - onClicked: { - if (scatterGraph.scene.activeCamera.cameraPreset === Camera3D.CameraPresetFront) { - scatterGraph.scene.activeCamera.cameraPreset = - Camera3D.CameraPresetIsometricRightHigh; - } else { - scatterGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetFront; - } + Button { + id: cameraToggle + width: portraitMode ? implicitWidth : (mainView.width / 6 - 6) + anchors.left: portraitMode ? parent.left : smoothToggle.right + anchors.top: portraitMode ? smoothToggle.bottom : parent.top + anchors.margins: 5 + text: "Change Camera Placement" + onClicked: { + if (scatterGraph.scene.activeCamera.cameraPreset === Camera3D.CameraPresetFront) { + scatterGraph.scene.activeCamera.cameraPreset = + Camera3D.CameraPresetIsometricRightHigh; + } else { + scatterGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetFront; } } + } - Button { - id: themeToggle - Layout.fillHeight: true - Layout.fillWidth: true - text: "Change Theme" - onClicked: { - if (scatterGraph.theme.type === Theme3D.ThemeArmyBlue) { - scatterGraph.theme = themeIsabelle - } else { - scatterGraph.theme = themeArmyBlue - } - if (scatterGraph.theme.backgroundEnabled === true) { - backgroundToggle.text = "Hide Background"; - } else { - backgroundToggle.text = "Show Background"; - } + Button { + id: themeToggle + width: portraitMode ? implicitWidth : (mainView.width / 6 - 6) + anchors.left: cameraToggle.right + anchors.top: portraitMode ? smoothToggle.bottom : parent.top + anchors.margins: 5 + text: "Change Theme" + onClicked: { + if (scatterGraph.theme.type === Theme3D.ThemeArmyBlue) { + scatterGraph.theme = themeIsabelle + } else { + scatterGraph.theme = themeArmyBlue + } + if (scatterGraph.theme.backgroundEnabled === true) { + backgroundToggle.text = "Hide Background"; + } else { + backgroundToggle.text = "Show Background"; } } + } - Button { - id: backgroundToggle - Layout.fillHeight: true - Layout.fillWidth: true - text: "Hide Background" - onClicked: { - if (scatterGraph.theme.backgroundEnabled === true) { - scatterGraph.theme.backgroundEnabled = false; - text = "Show Background"; - } else { - scatterGraph.theme.backgroundEnabled = true; - text = "Hide Background"; - } + Button { + id: backgroundToggle + width: portraitMode ? implicitWidth : (mainView.width / 6 - 6) + anchors.left: portraitMode ? parent.left : themeToggle.right + anchors.top: portraitMode ? themeToggle.bottom : parent.top + anchors.margins: 5 + text: "Hide Background" + onClicked: { + if (scatterGraph.theme.backgroundEnabled === true) { + scatterGraph.theme.backgroundEnabled = false; + text = "Show Background"; + } else { + scatterGraph.theme.backgroundEnabled = true; + text = "Hide Background"; } } + } - Button { - id: exitButton - Layout.fillHeight: true - Layout.fillWidth: true - text: "Quit" - onClicked: Qt.quit(); - } + Button { + id: exitButton + width: portraitMode ? implicitWidth : (mainView.width / 6 - 6) + anchors.left: backgroundToggle.right + anchors.top: portraitMode ? themeToggle.bottom : parent.top + anchors.margins: 5 + text: "Quit" + onClicked: Qt.quit(); } } diff --git a/examples/datavisualization/qmlspectrogram/qml/qmlspectrogram/main.qml b/examples/datavisualization/qmlspectrogram/qml/qmlspectrogram/main.qml index 35143179..c866f075 100644 --- a/examples/datavisualization/qmlspectrogram/qml/qmlspectrogram/main.qml +++ b/examples/datavisualization/qmlspectrogram/qml/qmlspectrogram/main.qml @@ -28,10 +28,9 @@ ****************************************************************************/ import QtQuick -import QtQuick.Layouts import QtQuick.Controls import QtQuick.Window -import QtDataVisualization 1.2 +import QtDataVisualization import "." Window { @@ -42,16 +41,18 @@ Window { height: 768 color: surfaceGraph.theme.windowColor + property bool portraitMode: width < height + Data { id: surfaceData } Item { id: surfaceView - width: mainview.width - height: mainview.height - anchors.top: mainview.top - anchors.left: mainview.left + anchors.top: buttons.bottom + anchors.left: parent.left + anchors.right: legend.left + anchors.bottom: parent.bottom ColorGradient { id: surfaceGradient @@ -114,8 +115,7 @@ Window { Surface3D { //! [7] id: surfaceGraph - width: surfaceView.width - height: surfaceView.height + anchors.fill: parent shadowQuality: AbstractGraph3D.ShadowQualityNone selectionMode: AbstractGraph3D.SelectionSlice | AbstractGraph3D.SelectionItemAndColumn @@ -164,26 +164,29 @@ Window { //! [0] } - RowLayout { - id: buttonLayout + Item { + id: buttons anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right - opacity: 0.5 + height: portraitMode ? (polarToggle.height + 10) * 3 : polarToggle.height + 30 + anchors.margins: 10 //! [3] Button { id: polarToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Switch to polar" + anchors.margins: 5 + anchors.left: parent.left + anchors.top: parent.top + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 50) / 5 + text: "Switch to\npolar" onClicked: { if (surfaceGraph.polar === false) { surfaceGraph.polar = true - text = "Switch to cartesian" + text = "Switch to\ncartesian" } else { surfaceGraph.polar = false - text = "Switch to polar" + text = "Switch to\npolar" } } } @@ -191,9 +194,11 @@ Window { Button { id: orthoToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Switch to perspective" + anchors.margins: 5 + anchors.left: polarToggle.right + anchors.top: parent.top + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 50) / 5 + text: "Switch to\nperspective" onClicked: { if (surfaceGraph.orthoProjection === true) { surfaceGraph.orthoProjection = false; @@ -201,7 +206,7 @@ Window { yAxis.labelAutoRotation = 30 zAxis.labelAutoRotation = 30 customInputHandler.rotationEnabled = true - text = "Switch to orthographic" + text = "Switch to\northographic" } else { surfaceGraph.orthoProjection = true; surfaceGraph.scene.activeCamera.cameraPreset = Camera3D.CameraPresetDirectlyAbove @@ -210,16 +215,18 @@ Window { yAxis.labelAutoRotation = 0 zAxis.labelAutoRotation = 0 customInputHandler.rotationEnabled = false - text = "Switch to perspective" + text = "Switch to\nperspective" } } } Button { id: flipGridToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Toggle axis grid on top" + anchors.margins: 5 + anchors.left: portraitMode ? parent.left : orthoToggle.right + anchors.top: portraitMode ? orthoToggle.bottom : parent.top + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 50) / 5 + text: "Toggle axis\ngrid on top" onClicked: { if (surfaceGraph.flipHorizontalGrid === true) { surfaceGraph.flipHorizontalGrid = false; @@ -231,9 +238,11 @@ Window { Button { id: labelOffsetToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Toggle radial label position" + anchors.margins: 5 + anchors.left: flipGridToggle.right + anchors.top: portraitMode ? orthoToggle.bottom : parent.top + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 50) / 5 + text: "Toggle radial\nlabel position" visible: surfaceGraph.polar onClicked: { if (surfaceGraph.radialLabelOffset >= 1.0) { @@ -246,9 +255,16 @@ Window { Button { id: surfaceGridToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Toggle surface grid" + anchors.margins: 5 + anchors.left: portraitMode ? (labelOffsetToggle.visible ? parent.left + : flipGridToggle.right) + : (labelOffsetToggle.visible ? labelOffsetToggle.right + : flipGridToggle.right) + anchors.top: portraitMode ? (labelOffsetToggle.visible ? labelOffsetToggle.bottom + : orthoToggle.bottom) + : parent.top + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 50) / 5 + text: "Toggle\nsurface grid" visible: !surfaceGraph.orthoProjection onClicked: { if (surfaceSeries.drawMode & Surface3DSeries.DrawWireframe) { @@ -258,46 +274,53 @@ Window { } } } - } - Rectangle { + Item { id: legend - anchors.margins: 20 anchors.bottom: parent.bottom - anchors.top: buttonLayout.bottom + anchors.top: buttons.bottom anchors.right: parent.right - border.color: "black" - border.width: 1 - width: 50 - rotation: 180 - gradient: Gradient { - GradientStop { position: 0.0; color: "black" } - GradientStop { position: 0.2; color: "red" } - GradientStop { position: 0.5; color: "blue" } - GradientStop { position: 0.8; color: "yellow" } - GradientStop { position: 1.0; color: "white" } + width: portraitMode ? 100 : 125 + + Rectangle { + id: gradient + anchors.margins: 20 + anchors.bottom: legend.bottom + anchors.top: legend.top + anchors.right: legend.right + border.color: "black" + border.width: 1 + width: portraitMode ? 25 : 50 + rotation: 180 + gradient: Gradient { + GradientStop { position: 0.0; color: "black" } + GradientStop { position: 0.2; color: "red" } + GradientStop { position: 0.5; color: "blue" } + GradientStop { position: 0.8; color: "yellow" } + GradientStop { position: 1.0; color: "white" } + } } - } - Text { - anchors.verticalCenter: legend.bottom - anchors.right: legend.left - anchors.margins: 2 - text: surfaceGraph.axisY.min + "%" - } + Text { + anchors.verticalCenter: gradient.bottom + anchors.right: gradient.left + anchors.margins: 2 + text: surfaceGraph.axisY.min + "%" + } - Text { - anchors.verticalCenter: legend.verticalCenter - anchors.right: legend.left - anchors.margins: 2 - text: (surfaceGraph.axisY.max + surfaceGraph.axisY.min) / 2 + "%" - } + Text { + anchors.verticalCenter: gradient.verticalCenter + anchors.right: gradient.left + anchors.margins: 2 + text: (surfaceGraph.axisY.max + surfaceGraph.axisY.min) / 2 + "%" + } - Text { - anchors.verticalCenter: legend.top - anchors.right: legend.left - anchors.margins: 2 - text: surfaceGraph.axisY.max + "%" + Text { + anchors.verticalCenter: gradient.top + anchors.right: gradient.left + anchors.margins: 2 + text: surfaceGraph.axisY.max + "%" + } } } diff --git a/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml b/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml index 2124346a..9597a557 100644 --- a/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml +++ b/examples/datavisualization/qmlsurface/qml/qmlsurface/main.qml @@ -28,9 +28,8 @@ ****************************************************************************/ import QtQuick -import QtQuick.Layouts import QtQuick.Controls -import QtDataVisualization 1.2 +import QtDataVisualization import "." Rectangle { @@ -39,16 +38,18 @@ Rectangle { height: 768 color: surfacePlot.theme.windowColor + property bool portraitMode: width < height + Data { id: surfaceData } Item { id: surfaceView - width: mainview.width - height: mainview.height - anchors.top: mainview.top + anchors.top: buttons.bottom + anchors.bottom: mainview.bottom anchors.left: mainview.left + anchors.right: mainview.right //! [0] ColorGradient { @@ -75,6 +76,7 @@ Rectangle { shadowQuality: AbstractGraph3D.ShadowQualityMedium selectionMode: AbstractGraph3D.SelectionSlice | AbstractGraph3D.SelectionItemAndRow scene.activeCamera.cameraPreset: Camera3D.CameraPresetIsometricLeft + scene.activeCamera.zoomLevel: 75 axisY.min: 0.0 axisY.max: 500.0 axisX.segmentCount: 10 @@ -129,18 +131,23 @@ Rectangle { } } - RowLayout { - id: buttonLayout + Item { + id: buttons anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right + anchors.margins: 10 + height: portraitMode ? surfaceGridToggle.implicitHeight * 3 + 20 + : surfaceGridToggle.implicitHeight * 2 + 15 opacity: 0.5 Button { id: surfaceGridToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Show Surface Grid" + anchors.margins: 5 + anchors.left: parent.left + anchors.top: parent.top + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 40) / 3 + text: "Show Surface\nGrid" //! [1] onClicked: { if (surfaceSeries.drawMode & Surface3DSeries.DrawWireframe) { @@ -156,9 +163,11 @@ Rectangle { Button { id: surfaceToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Hide Surface" + anchors.margins: 5 + anchors.left: surfaceGridToggle.right + anchors.top: parent.top + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 40) / 3 + text: "Hide\nSurface" //! [8] onClicked: { if (surfaceSeries.drawMode & Surface3DSeries.DrawSurface) { @@ -174,20 +183,22 @@ Rectangle { Button { id: flatShadingToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: surfaceSeries.flatShadingSupported ? "Show Flat" : "Flat not supported" + anchors.margins: 5 + anchors.left: portraitMode ? parent.left : surfaceToggle.right + anchors.top: portraitMode ? surfaceToggle.bottom : parent.top + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 40) / 3 + text: surfaceSeries.flatShadingSupported ? "Show\nFlat" : "Flat not\nsupported" enabled: surfaceSeries.flatShadingSupported //! [2] onClicked: { if (surfaceSeries.flatShadingEnabled === true) { surfaceSeries.flatShadingEnabled = false; heightSeries.flatShadingEnabled = false; - text = "Show Flat" + text = "Show\nFlat" } else { surfaceSeries.flatShadingEnabled = true; heightSeries.flatShadingEnabled = true; - text = "Show Smooth" + text = "Show\nSmooth" } } //! [2] @@ -195,41 +206,47 @@ Rectangle { Button { id: backgroundToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Hide Background" + anchors.margins: 5 + anchors.left: portraitMode ? flatShadingToggle.right : parent.left + anchors.top: portraitMode ? surfaceToggle.bottom : flatShadingToggle.bottom + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 40) / 3 + text: "Hide\nBackground" onClicked: { if (surfacePlot.theme.backgroundEnabled === true) { surfacePlot.theme.backgroundEnabled = false; - text = "Show Background" + text = "Show\nBackground" } else { surfacePlot.theme.backgroundEnabled = true; - text = "Hide Background" + text = "Hide\nBackground" } } } Button { id: gridToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Hide Grid" + anchors.margins: 5 + anchors.left: portraitMode ? parent.left : backgroundToggle.right + anchors.top: portraitMode ? backgroundToggle.bottom : surfaceToggle.bottom + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 40) / 3 + text: "Hide\nGrid" onClicked: { if (surfacePlot.theme.gridEnabled === true) { surfacePlot.theme.gridEnabled = false; - text = "Show Grid" + text = "Show\nGrid" } else { surfacePlot.theme.gridEnabled = true; - text = "Hide Grid" + text = "Hide\nGrid" } } } Button { id: seriesToggle - Layout.fillWidth: true - Layout.fillHeight: true - text: "Switch to Height Map Series" + anchors.margins: 5 + anchors.left: gridToggle.right + anchors.top: portraitMode ? backgroundToggle.bottom : surfaceToggle.bottom + width: portraitMode ? (mainview.width - 35) / 2 : (mainview.width - 40) / 3 + text: "Switch to\nHeight Map Series" //! [3] onClicked: { if (surfaceSeries.visible === false) { @@ -237,13 +254,13 @@ Rectangle { surfaceSeries.visible = true heightSeries.visible = false middleGradient.position = 0.25 - text = "Switch to Height Map Series" + text = "Switch to\nHeight Map Series" } else { surfacePlot.axisY.max = 250.0 surfaceSeries.visible = false heightSeries.visible = true middleGradient.position = 0.50 - text = "Switch to Item Model Series" + text = "Switch to\nItem Model Series" } } //! [3] @@ -252,13 +269,13 @@ Rectangle { function checkState() { if (surfaceSeries.drawMode & Surface3DSeries.DrawSurface) - surfaceToggle.text = "Hide Surface" + surfaceToggle.text = "Hide\nSurface" else - surfaceToggle.text = "Show Surface" + surfaceToggle.text = "Show\nSurface" if (surfaceSeries.drawMode & Surface3DSeries.DrawWireframe) - surfaceGridToggle.text = "Hide Surface Grid" + surfaceGridToggle.text = "Hide Surface\nGrid" else - surfaceGridToggle.text = "Show Surface Grid" + surfaceGridToggle.text = "Show Surface\nGrid" } } diff --git a/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml b/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml index b2469ba9..b15f8bac 100644 --- a/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml +++ b/examples/datavisualization/qmlsurfacelayers/qml/qmlsurfacelayers/main.qml @@ -39,10 +39,11 @@ Item { height: 720 property real fontSize: 12 + property bool portraitMode: width < height Item { id: surfaceView - width: mainview.width - buttonLayout.width + width: mainview.width - settings.width height: mainview.height anchors.right: mainview.right; @@ -134,175 +135,185 @@ Item { } } - ColumnLayout { - id: buttonLayout - anchors.top: parent.top - anchors.left: parent.left - spacing: 0 + Flickable { + id: settings + width: buttonLayout.width + contentHeight: buttonLayout.height + height: mainview.height - //! [3] - GroupBox { - Layout.fillWidth: true - Column { - spacing: 10 + ColumnLayout { + id: buttonLayout + anchors.top: parent.top + anchors.left: parent.left + spacing: 0 - Label { - font.pointSize: fontSize - font.bold: true - text: "Layer Selection" - } + //! [3] + GroupBox { + Layout.fillWidth: true + Column { + spacing: 10 - CheckBox { - id: layerOneToggle - checked: true - text: "Show Ground Layer" - } + Label { + font.pointSize: fontSize + font.bold: true + text: portraitMode ? "Layer\nSelection" : "Layer Selection" + } - CheckBox { - id: layerTwoToggle - checked: true - text: "Show Sea Layer" - } + CheckBox { + id: layerOneToggle + checked: true + text: portraitMode ? "Show\nGround\nLayer" : "Show Ground Layer" + } - CheckBox { - id: layerThreeToggle - checked: true - text: "Show Tectonic Layer" + CheckBox { + id: layerTwoToggle + checked: true + text: portraitMode ? "Show\nSea\nLayer" : "Show Sea Layer" + } + + CheckBox { + id: layerThreeToggle + checked: true + text: portraitMode ? "Show\nTectonic\nLayer" : "Show Tectonic Layer" + } } } - } - //! [3] + //! [3] - //! [5] - GroupBox { - Layout.fillWidth: true - Column { - spacing: 10 + //! [5] + GroupBox { + Layout.fillWidth: true + Column { + spacing: 10 - Label { - font.pointSize: fontSize - font.bold: true - text: "Layer Style" - } + Label { + font.pointSize: fontSize + font.bold: true + text: portraitMode ? "Layer\nStyle" : "Layer Style" + } - CheckBox { - id: layerOneGrid - text: "Show Ground as Grid" - onCheckedChanged: { - if (checked) - layerOneSeries.drawMode = Surface3DSeries.DrawWireframe - else - layerOneSeries.drawMode = Surface3DSeries.DrawSurface + CheckBox { + id: layerOneGrid + text: portraitMode ? "Show\nGround\nas Grid" : "Show Ground as Grid" + onCheckedChanged: { + if (checked) + layerOneSeries.drawMode = Surface3DSeries.DrawWireframe + else + layerOneSeries.drawMode = Surface3DSeries.DrawSurface + } } - } - CheckBox { - id: layerTwoGrid - text: "Show Sea as Grid" + CheckBox { + id: layerTwoGrid + text: portraitMode ? "Show\nSea\nas Grid" : "Show Sea as Grid" - onCheckedChanged: { - if (checked) - layerTwoSeries.drawMode = Surface3DSeries.DrawWireframe - else - layerTwoSeries.drawMode = Surface3DSeries.DrawSurface + onCheckedChanged: { + if (checked) + layerTwoSeries.drawMode = Surface3DSeries.DrawWireframe + else + layerTwoSeries.drawMode = Surface3DSeries.DrawSurface + } } - } - CheckBox { - id: layerThreeGrid - text: "Show Tectonic as Grid" - onCheckedChanged: { - if (checked) - layerThreeSeries.drawMode = Surface3DSeries.DrawWireframe - else - layerThreeSeries.drawMode = Surface3DSeries.DrawSurface + CheckBox { + id: layerThreeGrid + text: portraitMode ? "Show\nTectonic\nas Grid" : "Show Tectonic as Grid" + onCheckedChanged: { + if (checked) + layerThreeSeries.drawMode = Surface3DSeries.DrawWireframe + else + layerThreeSeries.drawMode = Surface3DSeries.DrawSurface + } } } } - } - //! [5] + //! [5] - //! [6] - Button { - id: sliceButton - text: "Slice All Layers" - Layout.fillWidth: true - Layout.minimumHeight: 40 - onClicked: { - if (surfaceLayers.selectionMode & AbstractGraph3D.SelectionMultiSeries) { - surfaceLayers.selectionMode = AbstractGraph3D.SelectionRow - | AbstractGraph3D.SelectionSlice - text = "Slice All Layers" - } else { - surfaceLayers.selectionMode = AbstractGraph3D.SelectionRow - | AbstractGraph3D.SelectionSlice - | AbstractGraph3D.SelectionMultiSeries - text = "Slice One Layer" + //! [6] + Button { + id: sliceButton + text: portraitMode ? "Slice\nAll\nLayers" : "Slice All Layers" + Layout.fillWidth: true + Layout.minimumHeight: 40 + onClicked: { + if (surfaceLayers.selectionMode & AbstractGraph3D.SelectionMultiSeries) { + surfaceLayers.selectionMode = AbstractGraph3D.SelectionRow + | AbstractGraph3D.SelectionSlice + text = portraitMode ? "Slice\nAll\nLayers" : "Slice All Layers" + } else { + surfaceLayers.selectionMode = AbstractGraph3D.SelectionRow + | AbstractGraph3D.SelectionSlice + | AbstractGraph3D.SelectionMultiSeries + text = portraitMode ? "Slice\nOne\nLayer" : "Slice One Layer" + } } } - } - //! [6] + //! [6] - Button { - id: shadowButton - Layout.fillWidth: true - Layout.minimumHeight: 40 - text: surfaceLayers.shadowsSupported ? "Show Shadows" : "Shadows not supported" - enabled: surfaceLayers.shadowsSupported - onClicked: { - if (surfaceLayers.shadowQuality === AbstractGraph3D.ShadowQualityNone) { - surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityLow - text = "Hide Shadows" - } else { - surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityNone - text = "Show Shadows" + Button { + id: shadowButton + Layout.fillWidth: true + Layout.minimumHeight: 40 + text: surfaceLayers.shadowsSupported ? (portraitMode ? "Show\nShadows" : "Show Shadows") + : (portraitMode ? "Shadows\nnot\nsupported" : "Shadows not supported") + enabled: surfaceLayers.shadowsSupported + onClicked: { + if (surfaceLayers.shadowQuality === AbstractGraph3D.ShadowQualityNone) { + surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityLow + text = portraitMode ? "Hide\nShadows" : "Hide Shadows" + } else { + surfaceLayers.shadowQuality = AbstractGraph3D.ShadowQualityNone + text = portraitMode ? "Show\nShadows" : "Show Shadows" + } } } - } - Button { - id: renderModeButton - text: "Switch Render Mode" - Layout.fillWidth: true - Layout.minimumHeight: 40 - onClicked: { - var modeText = "Indirect " - var aaText - if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && - surfaceLayers.msaaSamples === 0) { - surfaceLayers.renderingMode = AbstractGraph3D.RenderDirectToBackground - modeText = "BackGround " - } else if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && - surfaceLayers.msaaSamples === 4) { - surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect - surfaceLayers.msaaSamples = 0 - } else if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && - surfaceLayers.msaaSamples === 8) { - surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect - surfaceLayers.msaaSamples = 4 - } else { - surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect - surfaceLayers.msaaSamples = 8 - } + Button { + id: renderModeButton + text: portraitMode ? "Switch\nRender\nMode" : "Switch Render Mode" + Layout.fillWidth: true + Layout.minimumHeight: 40 + onClicked: { + var modeText = "Indirect, " + var aaText + if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && + surfaceLayers.msaaSamples === 0) { + surfaceLayers.renderingMode = AbstractGraph3D.RenderDirectToBackground + modeText = "BackGround, " + } else if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && + surfaceLayers.msaaSamples === 4) { + surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect + surfaceLayers.msaaSamples = 0 + } else if (surfaceLayers.renderingMode === AbstractGraph3D.RenderIndirect && + surfaceLayers.msaaSamples === 8) { + surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect + surfaceLayers.msaaSamples = 4 + } else { + surfaceLayers.renderingMode = AbstractGraph3D.RenderIndirect + surfaceLayers.msaaSamples = 8 + } - if (surfaceLayers.msaaSamples <= 0) { - aaText = "No AA" - } else { - aaText = surfaceLayers.msaaSamples + "xMSAA" - } + if (surfaceLayers.msaaSamples <= 0) { + aaText = "No AA" + } else { + aaText = surfaceLayers.msaaSamples + "xMSAA" + } - renderLabel.text = modeText + aaText + renderLabel.text = modeText + aaText + } } - } - TextField { - id: renderLabel - font.pointSize: fontSize - Layout.fillWidth: true - Layout.minimumHeight: 40 - enabled: false - horizontalAlignment: TextInput.AlignHCenter - text: "Indirect, " + surfaceLayers.msaaSamples + "xMSAA" + TextField { + id: renderLabel + font.pointSize: fontSize + Layout.fillWidth: true + Layout.minimumHeight: 40 + color: "gray" + enabled: false + horizontalAlignment: TextInput.AlignHCenter + wrapMode: TextField.WrapAtWordBoundaryOrAnywhere + text: "Indirect, " + surfaceLayers.msaaSamples + "xMSAA" + } } } } diff --git a/src/datavisualization/data/customrenderitem.cpp b/src/datavisualization/data/customrenderitem.cpp index 68e84c44..6279921d 100644 --- a/src/datavisualization/data/customrenderitem.cpp +++ b/src/datavisualization/data/customrenderitem.cpp @@ -68,9 +68,10 @@ CustomRenderItem::~CustomRenderItem() ObjectHelper::releaseObjectHelper(m_renderer, m_object); } -void CustomRenderItem::setMesh(const QString &meshFile) +bool CustomRenderItem::setMesh(const QString &meshFile) { ObjectHelper::resetObjectHelper(m_renderer, m_object, meshFile); + return m_object ? true : false; } void CustomRenderItem::setColorTable(const QList<QRgb> &colors) diff --git a/src/datavisualization/data/customrenderitem_p.h b/src/datavisualization/data/customrenderitem_p.h index 196e6aa0..e14b1de4 100644 --- a/src/datavisualization/data/customrenderitem_p.h +++ b/src/datavisualization/data/customrenderitem_p.h @@ -59,7 +59,7 @@ public: inline void setTexture(GLuint texture) { m_texture = texture; } inline GLuint texture() const { return m_texture; } - void setMesh(const QString &meshFile); + bool setMesh(const QString &meshFile); inline ObjectHelper *mesh() const { return m_object; } inline void setScaling(const QVector3D &scaling) { m_scaling = scaling; } inline const QVector3D &scaling() const { return m_scaling; } diff --git a/src/datavisualization/data/qcustom3ditem.cpp b/src/datavisualization/data/qcustom3ditem.cpp index 07e3c809..63ba2b20 100644 --- a/src/datavisualization/data/qcustom3ditem.cpp +++ b/src/datavisualization/data/qcustom3ditem.cpp @@ -58,7 +58,9 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty string Custom3DItem::meshFile * * The item mesh file name. The item in the file must be in Wavefront OBJ format and include - * vertices, normals, and UVs. It also needs to be in triangles. + * vertices, normals, and UVs. It also needs to be in triangles. If the file is missing either + * normals or UVs, loading will fail with an error message to the console output and the item will + * not be rendered. */ /*! \qmlproperty string Custom3DItem::textureFile @@ -203,6 +205,9 @@ QCustom3DItem::~QCustom3DItem() * * The item in the file must be in Wavefront OBJ format and include * vertices, normals, and UVs. It also needs to be in triangles. + * If the file is missing either normals or UVs, loading will fail + * with an error message to the console output and the item will + * not be rendered. */ void QCustom3DItem::setMeshFile(const QString &meshFile) { diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index 54487ba1..4a0b1c8f 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -749,8 +749,10 @@ void Abstract3DRenderer::updateCustomData(const QList<QCustom3DItem *> &customIt CustomRenderItem *renderItem = m_customRenderCache.value(item); if (!renderItem) renderItem = addCustomItem(item); - renderItem->setValid(true); - renderItem->setIndex(i); // always update index, as it must match the custom item index + if (renderItem) { + renderItem->setValid(true); + renderItem->setIndex(i); // always update index, as it must match the custom item index + } } // Check render item cache and remove items that are not in customItems list anymore @@ -1133,7 +1135,10 @@ CustomRenderItem *Abstract3DRenderer::addCustomItem(QCustom3DItem *item) CustomRenderItem *newItem = new CustomRenderItem(); newItem->setRenderer(this); newItem->setItemPointer(item); // Store pointer for render item updates - newItem->setMesh(item->meshFile()); + if (!newItem->setMesh(item->meshFile())) { + delete newItem; + return nullptr; + } newItem->setOrigPosition(item->position()); newItem->setOrigScaling(item->scaling()); newItem->setScalingAbsolute(item->isScalingAbsolute()); diff --git a/src/datavisualization/utils/meshloader.cpp b/src/datavisualization/utils/meshloader.cpp index 274d4a13..fa071a96 100644 --- a/src/datavisualization/utils/meshloader.cpp +++ b/src/datavisualization/utils/meshloader.cpp @@ -81,6 +81,10 @@ bool MeshLoader::loadOBJ(const QString &path, QList<QVector3D> &out_vertices, QStringList set1 = lineContents.at(1).split(slashTag); QStringList set2 = lineContents.at(2).split(slashTag); QStringList set3 = lineContents.at(3).split(slashTag); + if (set1.length() < 3 || set2.length() < 3 || set3.length() < 3) { + qWarning("The file being loaded is missing UVs and/or normals"); + return false; + } vertexIndex[0] = set1.at(0).toUInt(); vertexIndex[1] = set2.at(0).toUInt(); vertexIndex[2] = set3.at(0).toUInt(); diff --git a/src/datavisualization/utils/objecthelper.cpp b/src/datavisualization/utils/objecthelper.cpp index f8fa01de..87875a98 100644 --- a/src/datavisualization/utils/objecthelper.cpp +++ b/src/datavisualization/utils/objecthelper.cpp @@ -113,10 +113,19 @@ ObjectHelper *ObjectHelper::getObjectHelper(const Abstract3DRenderer *cacheId, objRef = new ObjectHelperRef; objRef->refCount = 0; objRef->obj = new ObjectHelper(objectFile); - objectTable->insert(objectFile, objRef); + if (objRef->obj->m_meshDataLoaded) { + objectTable->insert(objectFile, objRef); + } else { + delete objRef->obj; + delete objRef; + objRef = nullptr; + } + } + if (objRef) { + objRef->refCount++; + return objRef->obj; } - objRef->refCount++; - return objRef->obj; + return nullptr; } void ObjectHelper::load() @@ -140,41 +149,44 @@ void ObjectHelper::load() QList<QVector2D> uvs; QList<QVector3D> normals; bool loadOk = MeshLoader::loadOBJ(m_objectFile, vertices, uvs, normals); - if (!loadOk) - qFatal("loading failed"); - - // Index vertices - VertexIndexer::indexVBO(vertices, uvs, normals, m_indices, m_indexedVertices, m_indexedUVs, - m_indexedNormals); - - m_indexCount = m_indices.size(); - - glGenBuffers(1, &m_vertexbuffer); - glBindBuffer(GL_ARRAY_BUFFER, m_vertexbuffer); - glBufferData(GL_ARRAY_BUFFER, m_indexedVertices.size() * sizeof(QVector3D), - &m_indexedVertices.at(0), - GL_STATIC_DRAW); - glGenBuffers(1, &m_normalbuffer); - glBindBuffer(GL_ARRAY_BUFFER, m_normalbuffer); - glBufferData(GL_ARRAY_BUFFER, m_indexedNormals.size() * sizeof(QVector3D), - &m_indexedNormals.at(0), - GL_STATIC_DRAW); - - glGenBuffers(1, &m_uvbuffer); - glBindBuffer(GL_ARRAY_BUFFER, m_uvbuffer); - glBufferData(GL_ARRAY_BUFFER, m_indexedUVs.size() * sizeof(QVector2D), - &m_indexedUVs.at(0), GL_STATIC_DRAW); - - glGenBuffers(1, &m_elementbuffer); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_elementbuffer); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_indices.size() * sizeof(GLuint), - &m_indices.at(0), GL_STATIC_DRAW); - - glBindBuffer(GL_ARRAY_BUFFER, 0); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - - m_meshDataLoaded = true; + if (!loadOk) { + qCritical() << "Loading" << m_objectFile << "failed"; + m_meshDataLoaded = false; + } else { + // Index vertices + VertexIndexer::indexVBO(vertices, uvs, normals, m_indices, m_indexedVertices, m_indexedUVs, + m_indexedNormals); + + m_indexCount = m_indices.size(); + + glGenBuffers(1, &m_vertexbuffer); + glBindBuffer(GL_ARRAY_BUFFER, m_vertexbuffer); + glBufferData(GL_ARRAY_BUFFER, m_indexedVertices.size() * sizeof(QVector3D), + &m_indexedVertices.at(0), + GL_STATIC_DRAW); + + glGenBuffers(1, &m_normalbuffer); + glBindBuffer(GL_ARRAY_BUFFER, m_normalbuffer); + glBufferData(GL_ARRAY_BUFFER, m_indexedNormals.size() * sizeof(QVector3D), + &m_indexedNormals.at(0), + GL_STATIC_DRAW); + + glGenBuffers(1, &m_uvbuffer); + glBindBuffer(GL_ARRAY_BUFFER, m_uvbuffer); + glBufferData(GL_ARRAY_BUFFER, m_indexedUVs.size() * sizeof(QVector2D), + &m_indexedUVs.at(0), GL_STATIC_DRAW); + + glGenBuffers(1, &m_elementbuffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_elementbuffer); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, m_indices.size() * sizeof(GLuint), + &m_indices.at(0), GL_STATIC_DRAW); + + glBindBuffer(GL_ARRAY_BUFFER, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + + m_meshDataLoaded = true; + } } QT_END_NAMESPACE diff --git a/src/datavisualization/utils/qutils.h b/src/datavisualization/utils/qutils.h index dc72835e..6a35ff34 100644 --- a/src/datavisualization/utils/qutils.h +++ b/src/datavisualization/utils/qutils.h @@ -38,9 +38,7 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_MACOS -#pragma clang diagnostic ignored "-Wunused-function" -#endif +[[maybe_unused]] static inline QSurfaceFormat qDefaultSurfaceFormat(bool antialias) { bool isES = false; diff --git a/tests/auto/qmltest/CMakeLists.txt b/tests/auto/qmltest/CMakeLists.txt index 8ab433b4..3a53e40f 100644 --- a/tests/auto/qmltest/CMakeLists.txt +++ b/tests/auto/qmltest/CMakeLists.txt @@ -1,9 +1,15 @@ +file(GLOB_RECURSE test_data_glob + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + *) +list(APPEND test_data ${test_data_glob}) + qt_internal_add_test(tst_qmltest QMLTEST SOURCES tst_qmltest.cpp PUBLIC_LIBRARIES Qt::Gui + TESTDATA ${test_data} ) set(qmltest_resource_files diff --git a/tests/auto/qmltest/tst_qmltest.cpp b/tests/auto/qmltest/tst_qmltest.cpp index 26d56de6..cde45b0b 100644 --- a/tests/auto/qmltest/tst_qmltest.cpp +++ b/tests/auto/qmltest/tst_qmltest.cpp @@ -28,21 +28,33 @@ ****************************************************************************/ #include <QtQuickTest/quicktest.h> + +class tst_qmltest: public QObject +{ + Q_OBJECT +private slots: + void skiptest() { QSKIP("This test will fail, skipping."); }; +}; + int main(int argc, char **argv) { if (!qEnvironmentVariableIsEmpty("QEMU_LD_PREFIX")) { - qWarning("This test will fail due to QEMU emulation shortcomings."); - return 0; + qWarning("This test would fail due to QEMU emulation shortcomings, so it will be skipped."); + tst_qmltest skip; + return QTest::qExec(&skip, argc, argv); } #ifdef Q_OS_QNX if (qEnvironmentVariable("QTEST_ENVIRONMENT").split(' ').contains("ci") && qEnvironmentVariable("QT_QPA_PLATFORM").split(' ').contains("offscreen") ) { - qWarning("This test will fail on CI QNX QEMU without OpenGL support."); - return 0; + qWarning("This test would fail on CI QNX QEMU without OpenGL support, so it will be skipped."); + tst_qmltest skip; + return QTest::qExec(&skip, argc, argv); } #endif qputenv("QSG_RHI_BACKEND", "opengl"); QTEST_SET_MAIN_SOURCE_PATH return quick_test_main(argc, argv, "qmltest", QUICK_TEST_SOURCE_DIR); } + +#include "tst_qmltest.moc" diff --git a/tests/manual/barstest/CMakeLists.txt b/tests/manual/barstest/CMakeLists.txt index 8c4c9295..2d268023 100644 --- a/tests/manual/barstest/CMakeLists.txt +++ b/tests/manual/barstest/CMakeLists.txt @@ -7,6 +7,8 @@ qt_internal_add_manual_test(barstest GUI SOURCES chart.cpp chart.h + sliderwrapper.cpp sliderwrapper.h + buttonwrapper.cpp buttonwrapper.h custominputhandler.cpp custominputhandler.h main.cpp ) diff --git a/tests/manual/barstest/buttonwrapper.cpp b/tests/manual/barstest/buttonwrapper.cpp new file mode 100644 index 00000000..e1098fe9 --- /dev/null +++ b/tests/manual/barstest/buttonwrapper.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "buttonwrapper.h" +#include <QPushButton> + +ButtonWrapper::ButtonWrapper(QPushButton *button) +{ + m_button = button; +} + +void ButtonWrapper::setEnabled(int state) +{ + m_button->setEnabled(state); +} diff --git a/tests/manual/barstest/buttonwrapper.h b/tests/manual/barstest/buttonwrapper.h new file mode 100644 index 00000000..f3f40c7b --- /dev/null +++ b/tests/manual/barstest/buttonwrapper.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BUTTONWRAPPER_H +#define BUTTONWRAPPER_H + +#include <QObject> +class QPushButton; + +class ButtonWrapper : public QObject +{ + Q_OBJECT +public: + ButtonWrapper(QPushButton *button); + +public Q_SLOTS: + void setEnabled(int state); + +private: + QPushButton *m_button; +}; + +#endif // BUTTONWRAPPER_H diff --git a/tests/manual/barstest/chart.cpp b/tests/manual/barstest/chart.cpp index 7d878046..b139629a 100644 --- a/tests/manual/barstest/chart.cpp +++ b/tests/manual/barstest/chart.cpp @@ -266,7 +266,7 @@ void GraphModifier::start() restart(false); } -void GraphModifier::restart(bool dynamicData) +void GraphModifier::restart(int dynamicData) { m_static = !dynamicData; @@ -341,7 +341,7 @@ void GraphModifier::releaseSeries() m_graph->removeSeries(series); } -void GraphModifier::flipViews() +void GraphModifier::flipViews(bool checked) { m_graph->scene()->setSecondarySubviewOnTop(!m_graph->scene()->isSecondarySubviewOnTop()); qDebug() << "secondary subview on top:" << m_graph->scene()->isSecondarySubviewOnTop(); @@ -733,7 +733,7 @@ void GraphModifier::handleSelectionChange(const QPoint &position) qDebug() << "Selected bar position:" << position << "series:" << index; } -void GraphModifier::setUseNullInputHandler(bool useNull) +void GraphModifier::setUseNullInputHandler(int useNull) { qDebug() << "setUseNullInputHandler" << useNull; if (m_useNullInputHandler == useNull) @@ -826,7 +826,7 @@ QBarDataArray *GraphModifier::makeDummyData() } // Executes one step of the primary series test -void GraphModifier::primarySeriesTest() +void GraphModifier::primarySeriesTest(bool checked) { static int nextStep = 0; @@ -1048,7 +1048,7 @@ void GraphModifier::insertRemoveTestToggle() } } -void GraphModifier::toggleRotation() +void GraphModifier::toggleRotation(bool checked) { if (m_rotationTimer.isActive()) m_rotationTimer.stop(); @@ -1056,7 +1056,7 @@ void GraphModifier::toggleRotation() m_rotationTimer.start(20); } -void GraphModifier::useLogAxis() +void GraphModifier::useLogAxis(bool checked) { static int counter = -1; static QLogValue3DAxisFormatter *logFormatter = 0; @@ -1212,7 +1212,7 @@ void GraphModifier::addRemoveSeries() counter++; } -void GraphModifier::testItemAndRowChanges() +void GraphModifier::testItemAndRowChanges(bool checked) { static int counter = 0; const int rowCount = 12; @@ -1602,7 +1602,7 @@ void GraphModifier::rotateY(int rotation) m_graph->scene()->activeCamera()->setCameraPosition(m_xRotation, m_yRotation); } -void GraphModifier::setFpsMeasurement(bool enable) +void GraphModifier::setFpsMeasurement(int enable) { m_graph->setMeasureFps(enable); } @@ -1659,7 +1659,7 @@ void GraphModifier::setMaxY(int max) m_maxval = max; } -void GraphModifier::changeColorStyle() +void GraphModifier::changeColorStyle(bool checked) { int style = m_graph->activeTheme()->colorStyle(); @@ -1669,7 +1669,7 @@ void GraphModifier::changeColorStyle() m_graph->activeTheme()->setColorStyle(Q3DTheme::ColorStyle(style)); } -void GraphModifier::useOwnTheme() +void GraphModifier::useOwnTheme(bool checked) { // Own theme is persistent, any changes to it via UI will be remembered if (!m_ownTheme) { @@ -1708,7 +1708,7 @@ void GraphModifier::changeBaseColor(const QColor &color) m_graph->activeTheme()->setBaseColors(colors); } -void GraphModifier::setGradient() +void GraphModifier::setGradient(bool checked) { QLinearGradient barGradient(0, 0, 1, 100); barGradient.setColorAt(1.0, Qt::lightGray); @@ -1748,7 +1748,7 @@ void GraphModifier::toggleMultiseriesScaling() m_graph->setMultiSeriesUniform(!m_graph->isMultiSeriesUniform()); } -void GraphModifier::setReflection(bool enabled) +void GraphModifier::setReflection(int enabled) { m_graph->setReflection(enabled); } diff --git a/tests/manual/barstest/chart.h b/tests/manual/barstest/chart.h index 9a4cd60e..b7dcdeb7 100644 --- a/tests/manual/barstest/chart.h +++ b/tests/manual/barstest/chart.h @@ -68,7 +68,7 @@ public: void changeFontSize(int fontsize); void rotateX(int rotation); void rotateY(int rotation); - void setFpsMeasurement(bool enable); + void setFpsMeasurement(int state); void setBackgroundEnabled(int enabled); void setGridEnabled(int enabled); void setSpecsRatio(int barwidth); @@ -82,43 +82,43 @@ public: void setMinY(int min); void setMaxY(int max); void start(); - void restart(bool dynamicData); + void restart(int dynamicData); void selectBar(); void swapAxis(); void releaseAxes(); void releaseSeries(); void createMassiveArray(); - void useOwnTheme(); + void useOwnTheme(bool checked); void changeBaseColor(const QColor &color); - void changeColorStyle(); + void changeColorStyle(bool checked); void showFiveSeries(); QBarDataArray *makeDummyData(); - void primarySeriesTest(); + void primarySeriesTest(bool checked); void insertRemoveTestToggle(); - void toggleRotation(); - void useLogAxis(); + void toggleRotation(bool checked); + void useLogAxis(bool checked); void changeValueAxisFormat(const QString & text); void changeLogBase(const QString & text); void setFpsLabel(QLabel *fpsLabel) { m_fpsLabel = fpsLabel; } void addRemoveSeries(); - void testItemAndRowChanges(); + void testItemAndRowChanges(bool checked); void reverseValueAxis(int enabled); void setInputHandlerRotationEnabled(int enabled); void setInputHandlerZoomEnabled(int enabled); void setInputHandlerSelectionEnabled(int enabled); void setInputHandlerZoomAtTargetEnabled(int enabled); - void setReflection(bool enabled); + void setReflection(int enabled); void setReflectivity(int value); void toggleCustomItem(); public Q_SLOTS: - void flipViews(); - void setGradient(); + void flipViews(bool checked); + void setGradient(bool checked); void toggleMultiseriesScaling(); void changeShadowQuality(int quality); void shadowQualityUpdatedByVisual(QAbstract3DGraph::ShadowQuality shadowQuality); void handleSelectionChange(const QPoint &position); - void setUseNullInputHandler(bool useNull); + void setUseNullInputHandler(int useNull); void changeValueAxisSegments(int value); void handleRowAxisChanged(QCategory3DAxis *axis); @@ -150,7 +150,7 @@ private: int m_rowCount; float m_xRotation; float m_yRotation; - bool m_static; + int m_static; float m_barSpacingX; float m_barSpacingZ; int m_fontSize; diff --git a/tests/manual/barstest/main.cpp b/tests/manual/barstest/main.cpp index a0379fd7..1eddca65 100644 --- a/tests/manual/barstest/main.cpp +++ b/tests/manual/barstest/main.cpp @@ -28,6 +28,8 @@ ****************************************************************************/ #include "chart.h" +#include "sliderwrapper.h" +#include "buttonwrapper.h" #include <QApplication> #include <QWidget> @@ -595,12 +597,14 @@ int main(int argc, char **argv) QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, modifier, &GraphModifier::setUseNullInputHandler); - QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderX, - &QSlider::setEnabled); + SliderWrapper *rotationSliderWrapperX = new SliderWrapper(rotationSliderX); + SliderWrapper *rotationSliderWrapperY = new SliderWrapper(rotationSliderY); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderWrapperX, + &SliderWrapper::setEnabled); QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderX, &QSlider::setValue); - QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderY, - &QSlider::setEnabled); + QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderWrapperY, + &SliderWrapper::setEnabled); QObject::connect(rotationCheckBox, &QCheckBox::stateChanged, rotationSliderY, &QSlider::setValue); @@ -615,40 +619,59 @@ int main(int argc, char **argv) QObject::connect(toggleCustomItemButton, &QPushButton::clicked, modifier, &GraphModifier::toggleCustomItem); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addMultiDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertMultiDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeSingleDataButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowsButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowsButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, massiveArrayButton, - &QPushButton::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderX, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderZ, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderX, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderZ, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderY, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, maxSliderY, - &QSlider::setEnabled); - QObject::connect(staticCheckBox, &QCheckBox::stateChanged, swapAxisButton, - &QSlider::setEnabled); + ButtonWrapper *addDataButtonWrapper = new ButtonWrapper(addDataButton); + ButtonWrapper *addMultiDataButtonWrapper = new ButtonWrapper(addMultiDataButton); + ButtonWrapper *insertDataButtonWrapper = new ButtonWrapper(insertDataButton); + ButtonWrapper *insertMultiDataButtonWrapper = new ButtonWrapper(insertMultiDataButton); + ButtonWrapper *changeSingleDataButtonWrapper = new ButtonWrapper(changeSingleDataButton); + ButtonWrapper *changeRowButtonWrapper = new ButtonWrapper(changeRowButton); + ButtonWrapper *changeRowsButtonWrapper = new ButtonWrapper(changeRowsButton); + ButtonWrapper *massiveArrayButtonWrapper = new ButtonWrapper(massiveArrayButton); + ButtonWrapper *removeRowButtonWrapper = new ButtonWrapper(removeRowButton); + ButtonWrapper *removeRowsButtonWrapper = new ButtonWrapper(removeRowsButton); + + SliderWrapper *sampleSliderWrapperX = new SliderWrapper(sampleSliderX); + SliderWrapper *sampleSliderWrapperZ = new SliderWrapper(sampleSliderZ); + SliderWrapper *minSliderWrapperX = new SliderWrapper(minSliderX); + SliderWrapper *minSliderWrapperZ = new SliderWrapper(minSliderZ); + SliderWrapper *minSliderWrapperY = new SliderWrapper(minSliderY); + SliderWrapper *maxSliderWrapperY = new SliderWrapper(maxSliderY); + ButtonWrapper *swapAxisButtonWrapper = new ButtonWrapper(swapAxisButton); + + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, addMultiDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, insertMultiDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeSingleDataButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, changeRowsButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, removeRowsButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, massiveArrayButtonWrapper, + &ButtonWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderWrapperX, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, sampleSliderWrapperZ, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperX, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperZ, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, minSliderWrapperY, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, maxSliderWrapperY, + &SliderWrapper::setEnabled); + QObject::connect(staticCheckBox, &QCheckBox::stateChanged, swapAxisButtonWrapper, + &ButtonWrapper::setEnabled); QObject::connect(staticCheckBox, &QCheckBox::stateChanged, modifier, &GraphModifier::restart); modifier->setFpsLabel(fpsLabel); diff --git a/tests/manual/barstest/sliderwrapper.cpp b/tests/manual/barstest/sliderwrapper.cpp new file mode 100644 index 00000000..652f766c --- /dev/null +++ b/tests/manual/barstest/sliderwrapper.cpp @@ -0,0 +1,39 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "sliderwrapper.h" + +SliderWrapper::SliderWrapper(QSlider *slider) +{ + m_slider = slider; +} + +void SliderWrapper::setEnabled(int enabled) +{ + m_slider->setEnabled(enabled); +} diff --git a/tests/manual/barstest/sliderwrapper.h b/tests/manual/barstest/sliderwrapper.h new file mode 100644 index 00000000..38136490 --- /dev/null +++ b/tests/manual/barstest/sliderwrapper.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef SLIDERWRAPPER_H +#define SLIDERWRAPPER_H +#include <QObject> +#include <QSlider> + +class SliderWrapper : public QObject +{ + Q_OBJECT + +public: + explicit SliderWrapper(QSlider *slider); + +public Q_SLOTS: + void setEnabled(int enabled); + +private: + QSlider *m_slider = nullptr; + +}; + +#endif // SLIDERWRAPPER_H diff --git a/tests/manual/scattertest/scatterchart.cpp b/tests/manual/scattertest/scatterchart.cpp index ca8414ac..7f056aa5 100644 --- a/tests/manual/scattertest/scatterchart.cpp +++ b/tests/manual/scattertest/scatterchart.cpp @@ -244,7 +244,7 @@ void ScatterDataModifier::massiveTestAppendAndScroll() m_chart->axisZ()->setRange(min, max); } -void ScatterDataModifier::setFpsMeasurement(bool enable) +void ScatterDataModifier::setFpsMeasurement(int enable) { m_chart->setMeasureFps(enable); } @@ -973,14 +973,14 @@ void ScatterDataModifier::changeRadialLabelOffset(int offset) m_chart->setRadialLabelOffset(float(offset) / 100.0f); } -void ScatterDataModifier::toggleAxisTitleVisibility(bool enabled) +void ScatterDataModifier::toggleAxisTitleVisibility(int enabled) { m_chart->axisX()->setTitleVisible(enabled); m_chart->axisY()->setTitleVisible(enabled); m_chart->axisZ()->setTitleVisible(enabled); } -void ScatterDataModifier::toggleAxisTitleFixed(bool enabled) +void ScatterDataModifier::toggleAxisTitleFixed(int enabled) { m_chart->axisX()->setTitleFixed(enabled); m_chart->axisY()->setTitleFixed(enabled); @@ -1009,12 +1009,12 @@ void ScatterDataModifier::renderToImage() } } -void ScatterDataModifier::togglePolar(bool enable) +void ScatterDataModifier::togglePolar(int enable) { m_chart->setPolar(enable); } -void ScatterDataModifier::toggleStatic(bool enable) +void ScatterDataModifier::toggleStatic(int enable) { if (enable) m_chart->setOptimizationHints(QAbstract3DGraph::OptimizationStatic); @@ -1022,7 +1022,7 @@ void ScatterDataModifier::toggleStatic(bool enable) m_chart->setOptimizationHints(QAbstract3DGraph::OptimizationDefault); } -void ScatterDataModifier::toggleOrtho(bool enable) +void ScatterDataModifier::toggleOrtho(int enable) { m_chart->setOrthoProjection(enable); } diff --git a/tests/manual/scattertest/scatterchart.h b/tests/manual/scattertest/scatterchart.h index 43fabeac..bf1f060c 100644 --- a/tests/manual/scattertest/scatterchart.h +++ b/tests/manual/scattertest/scatterchart.h @@ -67,7 +67,7 @@ public: void massiveDataTest(); void massiveTestScroll(); void massiveTestAppendAndScroll(); - void setFpsMeasurement(bool enable); + void setFpsMeasurement(int enable); void setFpsLabel(QLabel *fpsLabel) { m_fpsLabel = fpsLabel; } void testItemChanges(); void testAxisReverse(); @@ -101,12 +101,12 @@ public Q_SLOTS: void handleFpsChange(qreal fps); void changeLabelRotation(int rotation); void changeRadialLabelOffset(int offset); - void toggleAxisTitleVisibility(bool enabled); - void toggleAxisTitleFixed(bool enabled); + void toggleAxisTitleVisibility(int enabled); + void toggleAxisTitleFixed(int enabled); void renderToImage(); - void togglePolar(bool enable); - void toggleStatic(bool enable); - void toggleOrtho(bool enable); + void togglePolar(int enable); + void toggleStatic(int enable); + void toggleOrtho(int enable); void setCameraTargetX(int value); void setCameraTargetY(int value); void setCameraTargetZ(int value); diff --git a/tests/manual/surfacetest/CMakeLists.txt b/tests/manual/surfacetest/CMakeLists.txt index c59f9488..a1e68d25 100644 --- a/tests/manual/surfacetest/CMakeLists.txt +++ b/tests/manual/surfacetest/CMakeLists.txt @@ -6,6 +6,8 @@ set(CMAKE_AUTOUIC ON) qt_internal_add_manual_test(surfacetest GUI SOURCES + buttonwrapper.cpp buttonwrapper.h + checkboxwrapper.cpp checkboxwrapper.h graphmodifier.cpp graphmodifier.h main.cpp ) diff --git a/tests/manual/surfacetest/buttonwrapper.cpp b/tests/manual/surfacetest/buttonwrapper.cpp new file mode 100644 index 00000000..e1098fe9 --- /dev/null +++ b/tests/manual/surfacetest/buttonwrapper.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "buttonwrapper.h" +#include <QPushButton> + +ButtonWrapper::ButtonWrapper(QPushButton *button) +{ + m_button = button; +} + +void ButtonWrapper::setEnabled(int state) +{ + m_button->setEnabled(state); +} diff --git a/tests/manual/surfacetest/buttonwrapper.h b/tests/manual/surfacetest/buttonwrapper.h new file mode 100644 index 00000000..f3f40c7b --- /dev/null +++ b/tests/manual/surfacetest/buttonwrapper.h @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef BUTTONWRAPPER_H +#define BUTTONWRAPPER_H + +#include <QObject> +class QPushButton; + +class ButtonWrapper : public QObject +{ + Q_OBJECT +public: + ButtonWrapper(QPushButton *button); + +public Q_SLOTS: + void setEnabled(int state); + +private: + QPushButton *m_button; +}; + +#endif // BUTTONWRAPPER_H diff --git a/tests/manual/surfacetest/checkboxwrapper.cpp b/tests/manual/surfacetest/checkboxwrapper.cpp new file mode 100644 index 00000000..3ee7548b --- /dev/null +++ b/tests/manual/surfacetest/checkboxwrapper.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "checkboxwrapper.h" +#include <QCheckBox> + +CheckBoxWrapper::CheckBoxWrapper(QCheckBox *cb) +{ + m_checkbox = cb; +} + +void CheckBoxWrapper::setEnabled(int enabled) +{ + m_checkbox->setEnabled(enabled); +} diff --git a/tests/manual/surfacetest/checkboxwrapper.h b/tests/manual/surfacetest/checkboxwrapper.h new file mode 100644 index 00000000..d0dda7ba --- /dev/null +++ b/tests/manual/surfacetest/checkboxwrapper.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2022 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef CHECKBOXWRAPPER_H +#define CHECKBOXWRAPPER_H + +#include <QObject> + +class QCheckBox; + +class CheckBoxWrapper : public QObject +{ + Q_OBJECT +public: + explicit CheckBoxWrapper(QCheckBox *cb); + +public Q_SLOTS: + void setEnabled(int enabled); + +private: + QCheckBox *m_checkbox; +}; + +#endif // CHECKBOXWRAPPER_H diff --git a/tests/manual/surfacetest/graphmodifier.cpp b/tests/manual/surfacetest/graphmodifier.cpp index 76c5afb9..01999ee0 100644 --- a/tests/manual/surfacetest/graphmodifier.cpp +++ b/tests/manual/surfacetest/graphmodifier.cpp @@ -193,7 +193,7 @@ void GraphModifier::fillSeries() m_multiseries[3]->dataProxy()->resetArray(dataArray4); } -void GraphModifier::toggleSeries1(bool enabled) +void GraphModifier::toggleSeries1(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -204,7 +204,7 @@ void GraphModifier::toggleSeries1(bool enabled) } } -void GraphModifier::toggleSeries2(bool enabled) +void GraphModifier::toggleSeries2(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -215,7 +215,7 @@ void GraphModifier::toggleSeries2(bool enabled) } } -void GraphModifier::toggleSeries3(bool enabled) +void GraphModifier::toggleSeries3(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -226,7 +226,7 @@ void GraphModifier::toggleSeries3(bool enabled) } } -void GraphModifier::toggleSeries4(bool enabled) +void GraphModifier::toggleSeries4(int enabled) { qDebug() << __FUNCTION__ << " enabled = " << enabled; @@ -237,7 +237,7 @@ void GraphModifier::toggleSeries4(bool enabled) } } -void GraphModifier::toggleSmooth(bool enabled) +void GraphModifier::toggleSmooth(int enabled) { qDebug() << "GraphModifier::toggleSmooth " << enabled; m_theSeries->setFlatShadingEnabled(enabled); @@ -246,7 +246,7 @@ void GraphModifier::toggleSmooth(bool enabled) #endif } -void GraphModifier::toggleSurfaceGrid(bool enable) +void GraphModifier::toggleSurfaceGrid(int enable) { qDebug() << "GraphModifier::toggleSurfaceGrid" << enable; if (enable) @@ -260,7 +260,7 @@ void GraphModifier::toggleSurfaceGrid(bool enable) #endif } -void GraphModifier::toggleSurface(bool enable) +void GraphModifier::toggleSurface(int enable) { qDebug() << "GraphModifier::toggleSurface" << enable; if (enable) @@ -274,7 +274,7 @@ void GraphModifier::toggleSurface(bool enable) #endif } -void GraphModifier::toggleSeriesVisible(bool enable) +void GraphModifier::toggleSeriesVisible(int enable) { m_theSeries->setVisible(enable); #ifdef MULTI_SERIES @@ -282,13 +282,13 @@ void GraphModifier::toggleSeriesVisible(bool enable) #endif } -void GraphModifier::toggleSmoothS2(bool enabled) +void GraphModifier::toggleSmoothS2(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[1]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS2(bool enable) +void GraphModifier::toggleSurfaceGridS2(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -299,7 +299,7 @@ void GraphModifier::toggleSurfaceGridS2(bool enable) m_multiseries[1]->setDrawMode(m_drawMode2); } -void GraphModifier::toggleSurfaceS2(bool enable) +void GraphModifier::toggleSurfaceS2(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -310,19 +310,19 @@ void GraphModifier::toggleSurfaceS2(bool enable) m_multiseries[1]->setDrawMode(m_drawMode2); } -void GraphModifier::toggleSeries2Visible(bool enable) +void GraphModifier::toggleSeries2Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[1]->setVisible(enable); } -void GraphModifier::toggleSmoothS3(bool enabled) +void GraphModifier::toggleSmoothS3(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[2]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS3(bool enable) +void GraphModifier::toggleSurfaceGridS3(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -333,7 +333,7 @@ void GraphModifier::toggleSurfaceGridS3(bool enable) m_multiseries[2]->setDrawMode(m_drawMode3); } -void GraphModifier::toggleSurfaceS3(bool enable) +void GraphModifier::toggleSurfaceS3(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -344,19 +344,19 @@ void GraphModifier::toggleSurfaceS3(bool enable) m_multiseries[2]->setDrawMode(m_drawMode3); } -void GraphModifier::toggleSeries3Visible(bool enable) +void GraphModifier::toggleSeries3Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[2]->setVisible(enable); } -void GraphModifier::toggleSmoothS4(bool enabled) +void GraphModifier::toggleSmoothS4(int enabled) { qDebug() << __FUNCTION__ << enabled; m_multiseries[3]->setFlatShadingEnabled(enabled); } -void GraphModifier::toggleSurfaceGridS4(bool enable) +void GraphModifier::toggleSurfaceGridS4(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -367,7 +367,7 @@ void GraphModifier::toggleSurfaceGridS4(bool enable) m_multiseries[3]->setDrawMode(m_drawMode4); } -void GraphModifier::toggleSurfaceS4(bool enable) +void GraphModifier::toggleSurfaceS4(int enable) { qDebug() << __FUNCTION__ << enable; if (enable) @@ -378,13 +378,13 @@ void GraphModifier::toggleSurfaceS4(bool enable) m_multiseries[3]->setDrawMode(m_drawMode4); } -void GraphModifier::toggleSeries4Visible(bool enable) +void GraphModifier::toggleSeries4Visible(int enable) { qDebug() << __FUNCTION__ << enable; m_multiseries[3]->setVisible(enable); } -void GraphModifier::toggleSqrtSin(bool enable) +void GraphModifier::toggleSqrtSin(int enable) { if (enable) { qDebug() << "Create Sqrt&Sin surface, (" << m_xCount << ", " << m_zCount << ")"; @@ -426,7 +426,7 @@ void GraphModifier::toggleSqrtSin(bool enable) } } -void GraphModifier::togglePlane(bool enable) +void GraphModifier::togglePlane(int enable) { qDebug() << "GraphModifier::togglePlane " << enable; @@ -749,21 +749,21 @@ void GraphModifier::changeLabelRotation(int rotation) m_graph->axisZ()->setLabelAutoRotation(float(rotation)); } -void GraphModifier::toggleAxisTitleVisibility(bool enabled) +void GraphModifier::toggleAxisTitleVisibility(int enabled) { m_graph->axisX()->setTitleVisible(enabled); m_graph->axisY()->setTitleVisible(enabled); m_graph->axisZ()->setTitleVisible(enabled); } -void GraphModifier::toggleAxisTitleFixed(bool enabled) +void GraphModifier::toggleAxisTitleFixed(int enabled) { m_graph->axisX()->setTitleFixed(enabled); m_graph->axisY()->setTitleFixed(enabled); m_graph->axisZ()->setTitleFixed(enabled); } -void GraphModifier::toggleXAscending(bool enabled) +void GraphModifier::toggleXAscending(int enabled) { m_ascendingX = enabled; @@ -793,7 +793,7 @@ void GraphModifier::toggleXAscending(bool enabled) } } -void GraphModifier::toggleZAscending(bool enabled) +void GraphModifier::toggleZAscending(int enabled) { m_ascendingZ = enabled; @@ -823,7 +823,7 @@ void GraphModifier::toggleZAscending(bool enabled) } } -void GraphModifier::togglePolar(bool enabled) +void GraphModifier::togglePolar(int enabled) { m_graph->setPolar(enabled); } @@ -1681,7 +1681,7 @@ void GraphModifier::setHorizontalAspectRatio(int ratio) m_graph->setHorizontalAspectRatio(aspectRatio); } -void GraphModifier::setSurfaceTexture(bool enabled) +void GraphModifier::setSurfaceTexture(int enabled) { if (enabled) m_multiseries[3]->setTexture(QImage(":/maps/mapimage")); diff --git a/tests/manual/surfacetest/graphmodifier.h b/tests/manual/surfacetest/graphmodifier.h index e535021a..747cec8d 100644 --- a/tests/manual/surfacetest/graphmodifier.h +++ b/tests/manual/surfacetest/graphmodifier.h @@ -53,29 +53,29 @@ public: explicit GraphModifier(Q3DSurface *graph, QWidget *parentWidget); ~GraphModifier(); - void toggleSeries1(bool enabled); - void toggleSeries2(bool enabled); - void toggleSeries3(bool enabled); - void toggleSeries4(bool enabled); - void toggleSmooth(bool enabled); - void toggleSurfaceGrid(bool enable); - void toggleSurface(bool enable); - void toggleSeriesVisible(bool enable); - void toggleSmoothS2(bool enabled); - void toggleSurfaceGridS2(bool enable); - void toggleSurfaceS2(bool enable); - void toggleSeries2Visible(bool enable); - void toggleSmoothS3(bool enabled); - void toggleSurfaceGridS3(bool enable); - void toggleSurfaceS3(bool enable); - void toggleSeries3Visible(bool enable); - void toggleSmoothS4(bool enabled); - void toggleSurfaceGridS4(bool enable); - void toggleSurfaceS4(bool enable); - void toggleSeries4Visible(bool enable); + void toggleSeries1(int enabled); + void toggleSeries2(int enabled); + void toggleSeries3(int enabled); + void toggleSeries4(int enabled); + void toggleSmooth(int enabled); + void toggleSurfaceGrid(int enable); + void toggleSurface(int enable); + void toggleSeriesVisible(int enable); + void toggleSmoothS2(int enabled); + void toggleSurfaceGridS2(int enable); + void toggleSurfaceS2(int enable); + void toggleSeries2Visible(int enable); + void toggleSmoothS3(int enabled); + void toggleSurfaceGridS3(int enable); + void toggleSurfaceS3(int enable); + void toggleSeries3Visible(int enable); + void toggleSmoothS4(int enabled); + void toggleSurfaceGridS4(int enable); + void toggleSurfaceS4(int enable); + void toggleSeries4Visible(int enable); - void toggleSqrtSin(bool enable); - void togglePlane(bool enable); + void toggleSqrtSin(int enable); + void togglePlane(int enable); void setHeightMapData(bool enable); void toggleGridSliderLock(bool enable); void setGridSliderX(QSlider *slider) { m_gridSliderX = slider; } @@ -123,7 +123,7 @@ public: void testDataOrdering(); void setAspectRatio(int ratio); void setHorizontalAspectRatio(int ratio); - void setSurfaceTexture(bool enabled); + void setSurfaceTexture(int enabled); public Q_SLOTS: void changeShadowQuality(int quality); @@ -138,11 +138,11 @@ public Q_SLOTS: void handleAxisZChanged(QValue3DAxis *axis); void handleFpsChange(qreal fps); void changeLabelRotation(int rotation); - void toggleAxisTitleVisibility(bool enabled); - void toggleAxisTitleFixed(bool enabled); - void toggleXAscending(bool enabled); - void toggleZAscending(bool enabled); - void togglePolar(bool enabled); + void toggleAxisTitleVisibility(int enabled); + void toggleAxisTitleFixed(int enabled); + void toggleXAscending(int enabled); + void toggleZAscending(int enabled); + void togglePolar(int enabled); void setCameraTargetX(int value); void setCameraTargetY(int value); void setCameraTargetZ(int value); diff --git a/tests/manual/surfacetest/main.cpp b/tests/manual/surfacetest/main.cpp index 239a6eba..bad8e75b 100644 --- a/tests/manual/surfacetest/main.cpp +++ b/tests/manual/surfacetest/main.cpp @@ -28,6 +28,8 @@ ****************************************************************************/ #include "graphmodifier.h" +#include "buttonwrapper.h" +#include "checkboxwrapper.h" #include <QtDataVisualization/q3dtheme.h> #include <QApplication> @@ -580,49 +582,66 @@ int main(int argc, char *argv[]) QObject::connect(series4VisibleCB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries4Visible); + CheckBoxWrapper *series1SmoothCBWrapper = new CheckBoxWrapper(smoothCB); + CheckBoxWrapper *series1SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridCB); + CheckBoxWrapper *series1surfaceCBWrapper = new CheckBoxWrapper(surfaceCB); + CheckBoxWrapper *series1VisibleCBWrapper = new CheckBoxWrapper(seriesVisibleCB); QObject::connect(series1CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries1); QObject::connect(series1CB, &QCheckBox::stateChanged, - smoothCB, &QPushButton::setEnabled); + series1SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - surfaceGridCB, &QPushButton::setEnabled); + series1SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - surfaceCB, &QPushButton::setEnabled); + series1surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series1CB, &QCheckBox::stateChanged, - seriesVisibleCB, &QPushButton::setEnabled); + series1VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + + CheckBoxWrapper *series2SmoothCBWrapper = new CheckBoxWrapper(smoothS2CB); + CheckBoxWrapper *series2SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS2CB); + CheckBoxWrapper *series2surfaceCBWrapper = new CheckBoxWrapper(surfaceS2CB); + CheckBoxWrapper *series2VisibleCBWrapper = new CheckBoxWrapper(series2VisibleCB); QObject::connect(series2CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries2); QObject::connect(series2CB, &QCheckBox::stateChanged, - smoothS2CB, &QPushButton::setEnabled); + series2SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - surfaceGridS2CB, &QPushButton::setEnabled); + series2SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - surfaceS2CB, &QPushButton::setEnabled); + series2surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series2CB, &QCheckBox::stateChanged, - series2VisibleCB, &QPushButton::setEnabled); + series2VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + CheckBoxWrapper *series3SmoothCBWrapper = new CheckBoxWrapper(smoothS3CB); + CheckBoxWrapper *series3SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS3CB); + CheckBoxWrapper *series3surfaceCBWrapper = new CheckBoxWrapper(surfaceS3CB); + CheckBoxWrapper *series3VisibleCBWrapper = new CheckBoxWrapper(series3VisibleCB); QObject::connect(series3CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries3); QObject::connect(series3CB, &QCheckBox::stateChanged, - smoothS3CB, &QPushButton::setEnabled); + series3SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - surfaceGridS3CB, &QPushButton::setEnabled); + series3SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - surfaceS3CB, &QPushButton::setEnabled); + series3surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series3CB, &QCheckBox::stateChanged, - series3VisibleCB, &QPushButton::setEnabled); + series3VisibleCBWrapper, &CheckBoxWrapper::setEnabled); + CheckBoxWrapper *series4SmoothCBWrapper = new CheckBoxWrapper(smoothS4CB); + CheckBoxWrapper *series4SurfaceGridCBWrapper = new CheckBoxWrapper(surfaceGridS4CB); + CheckBoxWrapper *series4surfaceCBWrapper = new CheckBoxWrapper(surfaceS4CB); + CheckBoxWrapper *series4VisibleCBWrapper = new CheckBoxWrapper(series4VisibleCB); QObject::connect(series4CB, &QCheckBox::stateChanged, modifier, &GraphModifier::toggleSeries4); QObject::connect(series4CB, &QCheckBox::stateChanged, - smoothS4CB, &QPushButton::setEnabled); + series4SmoothCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - surfaceGridS4CB, &QPushButton::setEnabled); + series4SurfaceGridCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - surfaceS4CB, &QPushButton::setEnabled); + series4surfaceCBWrapper, &CheckBoxWrapper::setEnabled); QObject::connect(series4CB, &QCheckBox::stateChanged, - series4VisibleCB, &QPushButton::setEnabled); + series4VisibleCBWrapper, &CheckBoxWrapper::setEnabled); #else QObject::connect(sqrtSinCB, &QRadioButton::toggled, modifier, &GraphModifier::toggleSqrtSin); |