aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/animation
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2024-12-20 08:35:46 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2025-01-06 15:44:37 +0100
commit76337a15b48ae189ee244fe1475a6203d396eeae (patch)
tree6aa736fd136b419fe9c3a6078295efb0d25de0fa /examples/widgets/animation
parent2156c0be5308ee9a8624769f6e949ce97df4be79 (diff)
Use fully qualified enumerations in more examples, round 2
Complements 7189a4c5ec193d30c6bd4e68701038880cbc5982. Pick-to: 6.8 Task-number: PYSIDE-1735 Change-Id: Ifbfd48e953e74c18c02fbe075ad51dfeb56b97c9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/widgets/animation')
-rw-r--r--examples/widgets/animation/easing/easing.py23
-rw-r--r--examples/widgets/animation/easing/form.ui16
-rw-r--r--examples/widgets/animation/easing/ui_form.py24
-rw-r--r--examples/widgets/animation/states/states.py2
4 files changed, 33 insertions, 32 deletions
diff --git a/examples/widgets/animation/easing/easing.py b/examples/widgets/animation/easing/easing.py
index e4fa69a0d..5ae9c0be6 100644
--- a/examples/widgets/animation/easing/easing.py
+++ b/examples/widgets/animation/easing/easing.py
@@ -65,7 +65,7 @@ class Pixmap(QObject):
super().__init__()
self.pixmap_item = QGraphicsPixmapItem(pix)
- self.pixmap_item.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
+ self.pixmap_item.setCacheMode(QGraphicsItem.CacheMode.DeviceCoordinateCache)
def set_pos(self, pos):
self.pixmap_item.setPos(pos)
@@ -110,7 +110,7 @@ class Window(QWidget):
self._ui.graphicsView.setScene(self._scene)
self._anim = Animation(self._item, b'pos')
- self._anim.setEasingCurve(QEasingCurve.OutBounce)
+ self._anim.setEasingCurve(QEasingCurve.Type.OutBounce)
self._ui.easingCurvePicker.setCurrentRow(0)
self.start_animation()
@@ -140,15 +140,15 @@ class Window(QWidget):
curve_scale = self._iconSize.height() / 2.0
- painter.setPen(Qt.NoPen)
+ painter.setPen(Qt.PenStyle.NoPen)
# Start point.
- painter.setBrush(Qt.red)
+ painter.setBrush(Qt.GlobalColor.red)
start = QPoint(y_axis, x_axis - curve_scale * curve.valueForProgress(0))
painter.drawRect(start.x() - 1, start.y() - 1, 3, 3)
# End point.
- painter.setBrush(Qt.blue)
+ painter.setBrush(Qt.GlobalColor.blue)
end = QPoint(y_axis + curve_scale,
x_axis - curve_scale * curve.valueForProgress(1))
painter.drawRect(end.x() - 1, end.y() - 1, 3, 3)
@@ -183,15 +183,16 @@ class Window(QWidget):
self._anim.setEasingCurve(curve_type)
self._anim.setCurrentTime(0)
- is_elastic = (curve_type.value >= QEasingCurve.InElastic.value
- and curve_type.value <= QEasingCurve.OutInElastic.value)
- is_bounce = (curve_type.value >= QEasingCurve.InBounce.value
- and curve_type.value <= QEasingCurve.OutInBounce.value)
+ is_elastic = (curve_type.value >= QEasingCurve.Type.InElastic.value
+ and curve_type.value <= QEasingCurve.Type.OutInElastic.value)
+ is_bounce = (curve_type.value >= QEasingCurve.Type.InBounce.value
+ and curve_type.value <= QEasingCurve.Type.OutInBounce.value)
self._ui.periodSpinBox.setEnabled(is_elastic)
self._ui.amplitudeSpinBox.setEnabled(is_elastic or is_bounce)
- self._ui.overshootSpinBox.setEnabled(curve_type.value >= QEasingCurve.InBack.value
- and curve_type.value <= QEasingCurve.OutInBack.value)
+ overshoot = (curve_type.value >= QEasingCurve.Type.InBack.value
+ and curve_type.value <= QEasingCurve.Type.OutInBack.value)
+ self._ui.overshootSpinBox.setEnabled(overshoot)
def path_changed(self, index):
self._anim.set_path_type(index)
diff --git a/examples/widgets/animation/easing/form.ui b/examples/widgets/animation/easing/form.ui
index 364aebeda..1a6340a9d 100644
--- a/examples/widgets/animation/easing/form.ui
+++ b/examples/widgets/animation/easing/form.ui
@@ -29,16 +29,16 @@
</size>
</property>
<property name="verticalScrollBarPolicy">
- <enum>Qt::ScrollBarAlwaysOff</enum>
+ <enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="movement">
- <enum>QListView::Static</enum>
+ <enum>QListView::Movement::Static</enum>
</property>
<property name="isWrapping" stdset="0">
<bool>false</bool>
</property>
<property name="viewMode">
- <enum>QListView::IconMode</enum>
+ <enum>QListView::ViewMode::IconMode</enum>
</property>
<property name="selectionRectVisible">
<bool>false</bool>
@@ -68,7 +68,7 @@
</size>
</property>
<property name="layoutDirection">
- <enum>Qt::LeftToRight</enum>
+ <enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string>Line</string>
@@ -77,7 +77,7 @@
<bool>true</bool>
</property>
<attribute name="buttonGroup">
- <string>buttonGroup</string>
+ <string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
@@ -93,7 +93,7 @@
<string>Circle</string>
</property>
<attribute name="buttonGroup">
- <string>buttonGroup</string>
+ <string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
@@ -113,7 +113,7 @@
</property>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
- <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+ <enum>QFormLayout::FieldGrowthPolicy::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
@@ -238,7 +238,7 @@
<item>
<spacer name="verticalSpacer">
<property name="orientation">
- <enum>Qt::Vertical</enum>
+ <enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
diff --git a/examples/widgets/animation/easing/ui_form.py b/examples/widgets/animation/easing/ui_form.py
index 7c9ce6abb..c879bb59d 100644
--- a/examples/widgets/animation/easing/ui_form.py
+++ b/examples/widgets/animation/easing/ui_form.py
@@ -3,7 +3,7 @@
################################################################################
## Form generated from reading UI file 'form.ui'
##
-## Created by: Qt User Interface Compiler version 6.8.0
+## Created by: Qt User Interface Compiler version 6.8.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
@@ -35,10 +35,10 @@ class Ui_Form(object):
sizePolicy.setHeightForWidth(self.easingCurvePicker.sizePolicy().hasHeightForWidth())
self.easingCurvePicker.setSizePolicy(sizePolicy)
self.easingCurvePicker.setMaximumSize(QSize(16777215, 120))
- self.easingCurvePicker.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
- self.easingCurvePicker.setMovement(QListView.Static)
+ self.easingCurvePicker.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
+ self.easingCurvePicker.setMovement(QListView.Movement.Static)
self.easingCurvePicker.setProperty(u"isWrapping", False)
- self.easingCurvePicker.setViewMode(QListView.IconMode)
+ self.easingCurvePicker.setViewMode(QListView.ViewMode.IconMode)
self.easingCurvePicker.setSelectionRectVisible(False)
self.gridLayout.addWidget(self.easingCurvePicker, 0, 0, 1, 2)
@@ -56,7 +56,7 @@ class Ui_Form(object):
self.buttonGroup.addButton(self.lineRadio)
self.lineRadio.setObjectName(u"lineRadio")
self.lineRadio.setMaximumSize(QSize(16777215, 40))
- self.lineRadio.setLayoutDirection(Qt.LeftToRight)
+ self.lineRadio.setLayoutDirection(Qt.LayoutDirection.LeftToRight)
self.lineRadio.setChecked(True)
self.gridLayout_2.addWidget(self.lineRadio, 0, 0, 1, 1)
@@ -80,7 +80,7 @@ class Ui_Form(object):
self.groupBox.setSizePolicy(sizePolicy1)
self.formLayout = QFormLayout(self.groupBox)
self.formLayout.setObjectName(u"formLayout")
- self.formLayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
+ self.formLayout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.AllNonFixedFieldsGrow)
self.label = QLabel(self.groupBox)
self.label.setObjectName(u"label")
sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred)
@@ -90,7 +90,7 @@ class Ui_Form(object):
self.label.setSizePolicy(sizePolicy2)
self.label.setMinimumSize(QSize(0, 30))
- self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label)
+ self.formLayout.setWidget(0, QFormLayout.ItemRole.LabelRole, self.label)
self.periodSpinBox = QDoubleSpinBox(self.groupBox)
self.periodSpinBox.setObjectName(u"periodSpinBox")
@@ -105,7 +105,7 @@ class Ui_Form(object):
self.periodSpinBox.setSingleStep(0.100000000000000)
self.periodSpinBox.setValue(-1.000000000000000)
- self.formLayout.setWidget(0, QFormLayout.FieldRole, self.periodSpinBox)
+ self.formLayout.setWidget(0, QFormLayout.ItemRole.FieldRole, self.periodSpinBox)
self.amplitudeSpinBox = QDoubleSpinBox(self.groupBox)
self.amplitudeSpinBox.setObjectName(u"amplitudeSpinBox")
@@ -115,13 +115,13 @@ class Ui_Form(object):
self.amplitudeSpinBox.setSingleStep(0.100000000000000)
self.amplitudeSpinBox.setValue(-1.000000000000000)
- self.formLayout.setWidget(2, QFormLayout.FieldRole, self.amplitudeSpinBox)
+ self.formLayout.setWidget(2, QFormLayout.ItemRole.FieldRole, self.amplitudeSpinBox)
self.label_3 = QLabel(self.groupBox)
self.label_3.setObjectName(u"label_3")
self.label_3.setMinimumSize(QSize(0, 30))
- self.formLayout.setWidget(4, QFormLayout.LabelRole, self.label_3)
+ self.formLayout.setWidget(4, QFormLayout.ItemRole.LabelRole, self.label_3)
self.overshootSpinBox = QDoubleSpinBox(self.groupBox)
self.overshootSpinBox.setObjectName(u"overshootSpinBox")
@@ -131,13 +131,13 @@ class Ui_Form(object):
self.overshootSpinBox.setSingleStep(0.100000000000000)
self.overshootSpinBox.setValue(-1.000000000000000)
- self.formLayout.setWidget(4, QFormLayout.FieldRole, self.overshootSpinBox)
+ self.formLayout.setWidget(4, QFormLayout.ItemRole.FieldRole, self.overshootSpinBox)
self.label_2 = QLabel(self.groupBox)
self.label_2.setObjectName(u"label_2")
self.label_2.setMinimumSize(QSize(0, 30))
- self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_2)
+ self.formLayout.setWidget(2, QFormLayout.ItemRole.LabelRole, self.label_2)
self.verticalLayout.addWidget(self.groupBox)
diff --git a/examples/widgets/animation/states/states.py b/examples/widgets/animation/states/states.py
index 97cdb452a..730aab1b3 100644
--- a/examples/widgets/animation/states/states.py
+++ b/examples/widgets/animation/states/states.py
@@ -65,7 +65,7 @@ if __name__ == '__main__':
# Parent widget.
widget = QGraphicsWidget()
- layout = QGraphicsLinearLayout(Qt.Vertical, widget)
+ layout = QGraphicsLinearLayout(Qt.Orientation.Vertical, widget)
layout.addItem(edit_proxy)
layout.addItem(button_proxy)
widget.setLayout(layout)