diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-09-18 10:33:50 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-09-18 20:11:10 +0200 |
| commit | fe5020b7e218078562c6b9b35d005553f53255fb (patch) | |
| tree | 3b362d3a228e0b331771d9816474d0cdf60286df /examples/graphs/3d/widgetgraphgallery/graphmodifier.py | |
| parent | 496ffda6aa0915ce6982093290aa565b8b464348 (diff) | |
widgetgraphgallery: Fix up and port away from deprecated QCheckBox::checkStateChanged()
Adapt to qtbase/3512fb1ec5ff088772170540c4e91b1886fbea45 .
Remove obsolete options and adapt to some API changes.
Task-number: PYSIDE-2620
Change-Id: I11738858cc9107129c0d0137043bae65d8cb4ac9
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'examples/graphs/3d/widgetgraphgallery/graphmodifier.py')
| -rw-r--r-- | examples/graphs/3d/widgetgraphgallery/graphmodifier.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/examples/graphs/3d/widgetgraphgallery/graphmodifier.py b/examples/graphs/3d/widgetgraphgallery/graphmodifier.py index 8c66cab10..5c4d23c92 100644 --- a/examples/graphs/3d/widgetgraphgallery/graphmodifier.py +++ b/examples/graphs/3d/widgetgraphgallery/graphmodifier.py @@ -6,7 +6,7 @@ from __future__ import annotations from math import atan, degrees import numpy as np -from PySide6.QtCore import QObject, QPropertyAnimation, Signal, Slot +from PySide6.QtCore import QObject, QPropertyAnimation, Qt, Signal, Slot from PySide6.QtGui import QFont, QVector3D from PySide6.QtGraphs import (QAbstract3DSeries, QBarDataItem, QBar3DSeries, QCategory3DAxis, @@ -258,13 +258,15 @@ class GraphModifier(QObject): self._yearAxis.setLabelAutoAngle(float(rotation)) @Slot(bool) - def setAxisTitleVisibility(self, enabled): + def setAxisTitleVisibility(self, state): + enabled = state == Qt.CheckState.Checked self._temperatureAxis.setTitleVisible(enabled) self._monthAxis.setTitleVisible(enabled) self._yearAxis.setTitleVisible(enabled) @Slot(bool) - def setAxisTitleFixed(self, enabled): + def setAxisTitleFixed(self, state): + enabled = state == Qt.CheckState.Checked self._temperatureAxis.setTitleFixed(enabled) self._monthAxis.setTitleFixed(enabled) self._yearAxis.setTitleFixed(enabled) @@ -351,26 +353,24 @@ class GraphModifier(QObject): self._yRotation = rotation self._graph.setCameraPosition(self._xRotation, self._yRotation) - def setPlotAreaBackgroundVisible(self, enabled): - self._graph.activeTheme().setPlotAreaBackgroundVisible(bool(enabled)) + def setPlotAreaBackgroundVisible(self, state): + enabled = state == Qt.CheckState.Checked + self._graph.activeTheme().setPlotAreaBackgroundVisible(enabled) - def setGridVisible(self, enabled): - self._graph.activeTheme().setGridVisible(bool(enabled)) + def setGridVisible(self, state): + self._graph.activeTheme().setGridVisible(state == Qt.CheckState.Checked) - def setSmoothBars(self, smooth): - self._smooth = bool(smooth) + def setSmoothBars(self, state): + self._smooth = state == Qt.CheckState.Checked self._primarySeries.setMeshSmooth(self._smooth) self._secondarySeries.setMeshSmooth(self._smooth) self._customData.customSeries().setMeshSmooth(self._smooth) - def setSeriesVisibility(self, enabled): - self._secondarySeries.setVisible(bool(enabled)) + def setSeriesVisibility(self, state): + self._secondarySeries.setVisible(state == Qt.CheckState.Checked) - def setReverseValueAxis(self, enabled): - self._graph.valueAxis().setReversed(enabled) - - def setReflection(self, enabled): - self._graph.setReflection(enabled) + def setReverseValueAxis(self, state): + self._graph.valueAxis().setReversed(state == Qt.CheckState.Checked) def changeDataMode(self, customData): # Change between weather data and data from custom proxy |
