aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/animation/animatedtiles/animatedtiles.py27
-rw-r--r--examples/widgets/animation/animatedtiles/animatedtiles.pyproject3
-rw-r--r--examples/widgets/animation/appchooser/appchooser.py2
-rw-r--r--examples/widgets/animation/appchooser/appchooser.pyproject2
-rw-r--r--examples/widgets/animation/easing/easing.py14
-rw-r--r--examples/widgets/animation/easing/images/qt-logo.pngbin5149 -> 0 bytes
-rw-r--r--examples/widgets/animation/easing/ui_form.py16
-rw-r--r--examples/widgets/animation/states/states.py2
-rw-r--r--examples/widgets/animation/states/states.pyproject2
-rw-r--r--examples/widgets/codeeditor/codeeditor.py104
-rw-r--r--examples/widgets/codeeditor/codeeditor.pyproject3
-rw-r--r--examples/widgets/codeeditor/doc/codeeditor.pngbin7759 -> 0 bytes
-rw-r--r--examples/widgets/codeeditor/doc/codeeditor.rst9
-rw-r--r--examples/widgets/codeeditor/main.py15
-rw-r--r--examples/widgets/desktop/systray/window.py8
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.py6
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.pyproject3
-rw-r--r--examples/widgets/dialogs/classwizard/listchooser.py2
-rw-r--r--examples/widgets/dialogs/findfiles/findfiles.py184
-rw-r--r--examples/widgets/dialogs/findfiles/findfiles.pyproject3
-rw-r--r--examples/widgets/dialogs/standarddialogs/standarddialogs.py122
-rw-r--r--examples/widgets/dialogs/trivialwizard/trivialwizard.py2
-rw-r--r--examples/widgets/draganddrop/draggabletext/draggabletext.py5
-rw-r--r--examples/widgets/draganddrop/draggabletext/draggabletext.pyproject3
-rw-r--r--examples/widgets/effects/lighting/lighting.py3
-rw-r--r--examples/widgets/gettext/doc/gettext.rst7
-rw-r--r--examples/widgets/graphicsview/anchorlayout/anchorlayout.py2
-rw-r--r--examples/widgets/graphicsview/collidingmice/collidingmice.py16
-rw-r--r--examples/widgets/graphicsview/collidingmice/collidingmice.pyproject2
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramscene.py129
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramscene.pyproject2
-rw-r--r--examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py53
-rw-r--r--examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pyproject2
-rw-r--r--examples/widgets/graphicsview/elasticnodes/elasticnodes.py20
-rw-r--r--examples/widgets/imageviewer/imageviewer.py2
-rw-r--r--examples/widgets/itemviews/address_book/adddialogwidget.py4
-rw-r--r--examples/widgets/itemviews/address_book/address_book.py15
-rw-r--r--examples/widgets/itemviews/address_book/addresswidget.py5
-rw-r--r--examples/widgets/itemviews/address_book/tablemodel.py4
-rw-r--r--examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py26
-rw-r--r--examples/widgets/itemviews/dirview/dirview.py1
-rw-r--r--examples/widgets/itemviews/editabletreemodel/mainwindow.py2
-rw-r--r--examples/widgets/itemviews/fetchmore/fetchmore.py4
-rw-r--r--examples/widgets/itemviews/jsonmodel/jsonmodel.py7
-rw-r--r--examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py3
-rw-r--r--examples/widgets/itemviews/stardelegate/stardelegate.py12
-rw-r--r--examples/widgets/itemviews/stardelegate/stareditor.py3
-rw-r--r--examples/widgets/itemviews/stardelegate/starrating.py6
-rw-r--r--examples/widgets/layouts/basiclayouts/basiclayouts.py5
-rw-r--r--examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py10
-rw-r--r--examples/widgets/linguist/doc/linguist.rst7
-rw-r--r--examples/widgets/linguist/linguist.qrc4
-rw-r--r--examples/widgets/linguist/main.py4
-rw-r--r--examples/widgets/mainwindows/application/application.py79
-rw-r--r--examples/widgets/mainwindows/application/application.pyproject2
-rw-r--r--examples/widgets/mainwindows/dockwidgets/dockwidgets.py76
-rw-r--r--examples/widgets/mainwindows/dockwidgets/dockwidgets.pyproject2
-rw-r--r--examples/widgets/mainwindows/mdi/images/copy.pngbin1338 -> 0 bytes
-rw-r--r--examples/widgets/mainwindows/mdi/images/cut.pngbin1323 -> 0 bytes
-rw-r--r--examples/widgets/mainwindows/mdi/images/new.pngbin852 -> 0 bytes
-rw-r--r--examples/widgets/mainwindows/mdi/images/open.pngbin2073 -> 0 bytes
-rw-r--r--examples/widgets/mainwindows/mdi/images/paste.pngbin1645 -> 0 bytes
-rw-r--r--examples/widgets/mainwindows/mdi/images/save.pngbin1187 -> 0 bytes
-rw-r--r--examples/widgets/mainwindows/mdi/mdi.py112
-rw-r--r--examples/widgets/mainwindows/mdi/mdi.pyproject2
-rw-r--r--examples/widgets/mainwindows/mdi/mdi.qrc10
-rw-r--r--examples/widgets/mainwindows/mdi/mdi_rc.py608
-rw-r--r--examples/widgets/painting/basicdrawing/basicdrawing.py27
-rw-r--r--examples/widgets/painting/basicdrawing/basicdrawing.pyproject2
-rw-r--r--examples/widgets/painting/concentriccircles/concentriccircles.py9
-rw-r--r--examples/widgets/painting/painter/painter.py8
-rw-r--r--examples/widgets/rhi/simplerhiwidget/doc/simplerhiwidget.rst34
-rw-r--r--examples/widgets/rhi/simplerhiwidget/doc/simplerhiwidget.webpbin0 -> 8556 bytes
-rw-r--r--examples/widgets/rhi/simplerhiwidget/examplewidget.py135
-rw-r--r--examples/widgets/rhi/simplerhiwidget/main.py35
-rw-r--r--examples/widgets/rhi/simplerhiwidget/rc_simplerhiwidget.py163
-rw-r--r--examples/widgets/rhi/simplerhiwidget/shader_assets/color.frag.qsbbin0 -> 738 bytes
-rw-r--r--examples/widgets/rhi/simplerhiwidget/shader_assets/color.vert.qsbbin0 -> 1091 bytes
-rw-r--r--examples/widgets/rhi/simplerhiwidget/shaders/color.frag10
-rw-r--r--examples/widgets/rhi/simplerhiwidget/shaders/color.vert16
-rw-r--r--examples/widgets/rhi/simplerhiwidget/simplerhiwidget.pyproject4
-rw-r--r--examples/widgets/rhi/simplerhiwidget/simplerhiwidget.qrc6
-rw-r--r--examples/widgets/richtext/orderform/orderform.py24
-rw-r--r--examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py4
-rw-r--r--examples/widgets/richtext/textedit/main.py2
-rw-r--r--examples/widgets/richtext/textedit/textedit.py45
-rw-r--r--examples/widgets/tools/regularexpression/regularexpressiondialog.py39
-rw-r--r--examples/widgets/tutorials/addressbook/part1.py5
-rw-r--r--examples/widgets/tutorials/addressbook/part2.py7
-rw-r--r--examples/widgets/tutorials/addressbook/part3.py7
-rw-r--r--examples/widgets/tutorials/addressbook/part4.py21
-rw-r--r--examples/widgets/tutorials/addressbook/part5.py26
-rw-r--r--examples/widgets/tutorials/addressbook/part6.py41
-rw-r--r--examples/widgets/tutorials/addressbook/part7.py48
-rw-r--r--examples/widgets/tutorials/cannon/t10.py6
-rw-r--r--examples/widgets/tutorials/cannon/t11.py6
-rw-r--r--examples/widgets/tutorials/cannon/t12.py6
-rw-r--r--examples/widgets/tutorials/cannon/t13.py6
-rw-r--r--examples/widgets/tutorials/cannon/t14.py9
-rw-r--r--examples/widgets/tutorials/cannon/t4.py2
-rw-r--r--examples/widgets/tutorials/cannon/t5.py2
-rw-r--r--examples/widgets/tutorials/cannon/t6.py2
-rw-r--r--examples/widgets/tutorials/cannon/t7.py2
-rw-r--r--examples/widgets/tutorials/cannon/t8.py6
-rw-r--r--examples/widgets/tutorials/cannon/t9.py6
-rw-r--r--examples/widgets/tutorials/modelview/2_formatting.py2
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel.py1
-rw-r--r--examples/widgets/tutorials/modelview/6_treeview.py1
-rw-r--r--examples/widgets/tutorials/modelview/7_selections.py1
-rw-r--r--examples/widgets/widgets/charactermap/characterwidget.py4
-rw-r--r--examples/widgets/widgets/charactermap/mainwindow.py2
-rw-r--r--examples/widgets/widgets/digitalclock/doc/digitalclock.rst2
-rw-r--r--examples/widgets/widgets/tetrix/tetrix.py49
-rw-r--r--examples/widgets/widgetsgallery/main.py1
-rw-r--r--examples/widgets/widgetsgallery/widgetgallery.py20
115 files changed, 1068 insertions, 1574 deletions
diff --git a/examples/widgets/animation/animatedtiles/animatedtiles.py b/examples/widgets/animation/animatedtiles/animatedtiles.py
index b621ec117..02fc75bf5 100644
--- a/examples/widgets/animation/animatedtiles/animatedtiles.py
+++ b/examples/widgets/animation/animatedtiles/animatedtiles.py
@@ -15,7 +15,7 @@ from PySide6.QtWidgets import (QApplication, QGraphicsItem, QGraphicsPixmapItem,
QGraphicsWidget, QStyle)
from PySide6.QtStateMachine import QState, QStateMachine
-import animatedtiles_rc
+import animatedtiles_rc # noqa: F401
# Deriving from more than one wrapped class is not supported, so we use
@@ -95,7 +95,7 @@ class Button(QGraphicsWidget):
painter.drawEllipse(r.adjusted(5, 5, -5, -5))
painter.drawPixmap(-self._pix.width() / 2, -self._pix.height() / 2,
- self._pix)
+ self._pix)
def mousePressEvent(self, ev):
self.pressed.emit()
@@ -123,7 +123,7 @@ if __name__ == '__main__':
for i in range(64):
item = Pixmap(kinetic_pix)
item.pixmap_item.setOffset(-kinetic_pix.width() / 2,
- -kinetic_pix.height() / 2)
+ -kinetic_pix.height() / 2)
item.pixmap_item.setZValue(i)
items.append(item)
scene.addItem(item.pixmap_item)
@@ -161,23 +161,25 @@ if __name__ == '__main__':
for i, item in enumerate(items):
# Ellipse.
ellipse_state.assignProperty(item, 'pos',
- QPointF(math.cos((i / 63.0) * 6.28) * 250,
- math.sin((i / 63.0) * 6.28) * 250))
+ QPointF(math.cos((i / 63.0) * 6.28) * 250,
+ math.sin((i / 63.0) * 6.28) * 250))
# Figure 8.
figure_8state.assignProperty(item, 'pos',
- QPointF(math.sin((i / 63.0) * 6.28) * 250,
- math.sin(((i * 2) / 63.0) * 6.28) * 250))
+ QPointF(math.sin((i / 63.0) * 6.28) * 250,
+ math.sin(((i * 2) / 63.0) * 6.28) * 250))
# Random.
random_state.assignProperty(item, 'pos',
- QPointF(-250 + generator.bounded(0, 500),
- -250 + generator.bounded(0, 500)))
+ QPointF(-250 + generator.bounded(0, 500),
+ -250 + generator.bounded(0, 500)))
# Tiled.
+ width = kinetic_pix.width()
+ height = kinetic_pix.height()
tiled_state.assignProperty(item, 'pos',
- QPointF(((i % 8) - 4) * kinetic_pix.width() + kinetic_pix.width() / 2,
- ((i // 8) - 4) * kinetic_pix.height() + kinetic_pix.height() / 2))
+ QPointF(((i % 8) - 4) * width + width / 2,
+ ((i // 8) - 4) * height + height / 2))
# Centered.
centered_state.assignProperty(item, 'pos', QPointF())
@@ -188,8 +190,7 @@ if __name__ == '__main__':
view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
view.setBackgroundBrush(QBrush(bg_pix))
view.setCacheMode(QGraphicsView.CacheBackground)
- view.setRenderHints(
- QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
+ view.setRenderHints(QPainter.Antialiasing | QPainter.SmoothPixmapTransform)
view.show()
states = QStateMachine()
diff --git a/examples/widgets/animation/animatedtiles/animatedtiles.pyproject b/examples/widgets/animation/animatedtiles/animatedtiles.pyproject
index 08ee55685..20f4abe43 100644
--- a/examples/widgets/animation/animatedtiles/animatedtiles.pyproject
+++ b/examples/widgets/animation/animatedtiles/animatedtiles.pyproject
@@ -1,4 +1,3 @@
{
- "files": ["animatedtiles.qrc", "animatedtiles.py",
- "animatedtiles_rc.py"]
+ "files": ["animatedtiles.qrc", "animatedtiles.py"]
}
diff --git a/examples/widgets/animation/appchooser/appchooser.py b/examples/widgets/animation/appchooser/appchooser.py
index e49f37dec..610050210 100644
--- a/examples/widgets/animation/appchooser/appchooser.py
+++ b/examples/widgets/animation/appchooser/appchooser.py
@@ -11,7 +11,7 @@ from PySide6.QtWidgets import (QApplication, QGraphicsScene, QGraphicsView,
QGraphicsWidget)
from PySide6.QtStateMachine import QState, QStateMachine
-import appchooser_rc
+import appchooser_rc # noqa: F401
class Pixmap(QGraphicsWidget):
diff --git a/examples/widgets/animation/appchooser/appchooser.pyproject b/examples/widgets/animation/appchooser/appchooser.pyproject
index 14bc351a1..f4c122bef 100644
--- a/examples/widgets/animation/appchooser/appchooser.pyproject
+++ b/examples/widgets/animation/appchooser/appchooser.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["appchooser_rc.py", "appchooser.py", "appchooser.qrc"]
+ "files": ["appchooser.py", "appchooser.qrc"]
}
diff --git a/examples/widgets/animation/easing/easing.py b/examples/widgets/animation/easing/easing.py
index f8cba0060..ba5032458 100644
--- a/examples/widgets/animation/easing/easing.py
+++ b/examples/widgets/animation/easing/easing.py
@@ -125,7 +125,6 @@ class Window(QWidget):
curve_types = [(f"QEasingCurve.{e.name}", e) for e in QEasingCurve.Type if e.value <= 40]
-
with QPainter(pix) as painter:
for curve_name, curve_type in curve_types:
@@ -144,14 +143,13 @@ class Window(QWidget):
# Start point.
painter.setBrush(Qt.red)
- start = QPoint(y_axis,
- x_axis - curve_scale * curve.valueForProgress(0))
+ 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)
end = QPoint(y_axis + curve_scale,
- x_axis - curve_scale * curve.valueForProgress(1))
+ x_axis - curve_scale * curve.valueForProgress(1))
painter.drawRect(end.x() - 1, end.y() - 1, 3, 3)
curve_path = QPainterPath()
@@ -159,7 +157,7 @@ class Window(QWidget):
t = 0.0
while t <= 1.0:
to = QPointF(y_axis + curve_scale * t,
- x_axis - curve_scale * curve.valueForProgress(t))
+ x_axis - curve_scale * curve.valueForProgress(t))
curve_path.lineTo(to)
t += 1.0 / curve_scale
@@ -185,14 +183,14 @@ class Window(QWidget):
self._anim.setCurrentTime(0)
is_elastic = (curve_type.value >= QEasingCurve.InElastic.value
- and curve_type.value <= QEasingCurve.OutInElastic.value)
+ and curve_type.value <= QEasingCurve.OutInElastic.value)
is_bounce = (curve_type.value >= QEasingCurve.InBounce.value
- and curve_type.value <= QEasingCurve.OutInBounce.value)
+ and curve_type.value <= QEasingCurve.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)
+ and curve_type.value <= QEasingCurve.OutInBack.value)
def path_changed(self, index):
self._anim.set_path_type(index)
diff --git a/examples/widgets/animation/easing/images/qt-logo.png b/examples/widgets/animation/easing/images/qt-logo.png
deleted file mode 100644
index 14ddf2a02..000000000
--- a/examples/widgets/animation/easing/images/qt-logo.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/animation/easing/ui_form.py b/examples/widgets/animation/easing/ui_form.py
index 0ff7a1547..2925cbae7 100644
--- a/examples/widgets/animation/easing/ui_form.py
+++ b/examples/widgets/animation/easing/ui_form.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
################################################################################
-## Form generated from reading UI file 'form2.ui'
+## Form generated from reading UI file 'form.ui'
##
-## Created by: Qt User Interface Compiler version 6.4.0
+## Created by: Qt User Interface Compiler version 6.7.0
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
@@ -29,7 +29,7 @@ class Ui_Form(object):
self.gridLayout.setObjectName(u"gridLayout")
self.easingCurvePicker = QListWidget(Form)
self.easingCurvePicker.setObjectName(u"easingCurvePicker")
- sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
+ sizePolicy = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.easingCurvePicker.sizePolicy().hasHeightForWidth())
@@ -73,7 +73,7 @@ class Ui_Form(object):
self.groupBox = QGroupBox(Form)
self.groupBox.setObjectName(u"groupBox")
- sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
+ sizePolicy1 = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred)
sizePolicy1.setHorizontalStretch(0)
sizePolicy1.setVerticalStretch(0)
sizePolicy1.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth())
@@ -83,7 +83,7 @@ class Ui_Form(object):
self.formLayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
self.label = QLabel(self.groupBox)
self.label.setObjectName(u"label")
- sizePolicy2 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
+ sizePolicy2 = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Preferred)
sizePolicy2.setHorizontalStretch(0)
sizePolicy2.setVerticalStretch(0)
sizePolicy2.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
@@ -95,7 +95,7 @@ class Ui_Form(object):
self.periodSpinBox = QDoubleSpinBox(self.groupBox)
self.periodSpinBox.setObjectName(u"periodSpinBox")
self.periodSpinBox.setEnabled(False)
- sizePolicy3 = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
+ sizePolicy3 = QSizePolicy(QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Fixed)
sizePolicy3.setHorizontalStretch(0)
sizePolicy3.setVerticalStretch(0)
sizePolicy3.setHeightForWidth(self.periodSpinBox.sizePolicy().hasHeightForWidth())
@@ -142,7 +142,7 @@ class Ui_Form(object):
self.verticalLayout.addWidget(self.groupBox)
- self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+ self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding)
self.verticalLayout.addItem(self.verticalSpacer)
@@ -151,7 +151,7 @@ class Ui_Form(object):
self.graphicsView = QGraphicsView(Form)
self.graphicsView.setObjectName(u"graphicsView")
- sizePolicy4 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
+ sizePolicy4 = QSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
sizePolicy4.setHorizontalStretch(0)
sizePolicy4.setVerticalStretch(0)
sizePolicy4.setHeightForWidth(self.graphicsView.sizePolicy().hasHeightForWidth())
diff --git a/examples/widgets/animation/states/states.py b/examples/widgets/animation/states/states.py
index 9b85e8373..509c3a7aa 100644
--- a/examples/widgets/animation/states/states.py
+++ b/examples/widgets/animation/states/states.py
@@ -16,7 +16,7 @@ from PySide6.QtWidgets import (QApplication, QGraphicsLinearLayout,
from PySide6.QtStateMachine import QState, QStateMachine
-import states_rc
+import states_rc # noqa: F401
class Pixmap(QGraphicsObject):
diff --git a/examples/widgets/animation/states/states.pyproject b/examples/widgets/animation/states/states.pyproject
index d94cf2e65..45ad44e97 100644
--- a/examples/widgets/animation/states/states.pyproject
+++ b/examples/widgets/animation/states/states.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["states.py", "states_rc.py"]
+ "files": ["states.py"]
}
diff --git a/examples/widgets/codeeditor/codeeditor.py b/examples/widgets/codeeditor/codeeditor.py
deleted file mode 100644
index 22f0b685b..000000000
--- a/examples/widgets/codeeditor/codeeditor.py
+++ /dev/null
@@ -1,104 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-from PySide6.QtCore import Slot, Qt, QRect, QSize
-from PySide6.QtGui import QColor, QPainter, QTextFormat
-from PySide6.QtWidgets import QPlainTextEdit, QWidget, QTextEdit
-
-
-class LineNumberArea(QWidget):
- def __init__(self, editor):
- QWidget.__init__(self, editor)
- self._code_editor = editor
-
- def sizeHint(self):
- return QSize(self._code_editor.line_number_area_width(), 0)
-
- def paintEvent(self, event):
- self._code_editor.lineNumberAreaPaintEvent(event)
-
-
-class CodeEditor(QPlainTextEdit):
- def __init__(self):
- super().__init__()
- self.line_number_area = LineNumberArea(self)
-
- self.blockCountChanged[int].connect(self.update_line_number_area_width)
- self.updateRequest[QRect, int].connect(self.update_line_number_area)
- self.cursorPositionChanged.connect(self.highlight_current_line)
-
- self.update_line_number_area_width(0)
- self.highlight_current_line()
-
- def line_number_area_width(self):
- digits = 1
- max_num = max(1, self.blockCount())
- while max_num >= 10:
- max_num *= 0.1
- digits += 1
-
- space = 3 + self.fontMetrics().horizontalAdvance('9') * digits
- return space
-
- def resizeEvent(self, e):
- super().resizeEvent(e)
- cr = self.contentsRect()
- width = self.line_number_area_width()
- rect = QRect(cr.left(), cr.top(), width, cr.height())
- self.line_number_area.setGeometry(rect)
-
- def lineNumberAreaPaintEvent(self, event):
- with QPainter(self.line_number_area) as painter:
- painter.fillRect(event.rect(), Qt.lightGray)
- block = self.firstVisibleBlock()
- block_number = block.blockNumber()
- offset = self.contentOffset()
- top = self.blockBoundingGeometry(block).translated(offset).top()
- bottom = top + self.blockBoundingRect(block).height()
-
- while block.isValid() and top <= event.rect().bottom():
- if block.isVisible() and bottom >= event.rect().top():
- number = str(block_number + 1)
- painter.setPen(Qt.black)
- width = self.line_number_area.width()
- height = self.fontMetrics().height()
- painter.drawText(0, top, width, height, Qt.AlignRight, number)
-
- block = block.next()
- top = bottom
- bottom = top + self.blockBoundingRect(block).height()
- block_number += 1
-
- @Slot(int)
- def update_line_number_area_width(self, newBlockCount):
- self.setViewportMargins(self.line_number_area_width(), 0, 0, 0)
-
- @Slot(QRect, int)
- def update_line_number_area(self, rect, dy):
- if dy:
- self.line_number_area.scroll(0, dy)
- else:
- width = self.line_number_area.width()
- self.line_number_area.update(0, rect.y(), width, rect.height())
-
- if rect.contains(self.viewport().rect()):
- self.update_line_number_area_width(0)
-
- @Slot()
- def highlight_current_line(self):
- extra_selections = []
-
- if not self.isReadOnly():
- selection = QTextEdit.ExtraSelection()
-
- line_color = QColor(Qt.yellow).lighter(160)
- selection.format.setBackground(line_color)
-
- selection.format.setProperty(QTextFormat.FullWidthSelection, True)
-
- selection.cursor = self.textCursor()
- selection.cursor.clearSelection()
-
- extra_selections.append(selection)
-
- self.setExtraSelections(extra_selections)
diff --git a/examples/widgets/codeeditor/codeeditor.pyproject b/examples/widgets/codeeditor/codeeditor.pyproject
deleted file mode 100644
index f51cfc6d2..000000000
--- a/examples/widgets/codeeditor/codeeditor.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["codeeditor.py", "main.py"]
-}
diff --git a/examples/widgets/codeeditor/doc/codeeditor.png b/examples/widgets/codeeditor/doc/codeeditor.png
deleted file mode 100644
index e3def6b04..000000000
--- a/examples/widgets/codeeditor/doc/codeeditor.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/codeeditor/doc/codeeditor.rst b/examples/widgets/codeeditor/doc/codeeditor.rst
deleted file mode 100644
index 16345eaa3..000000000
--- a/examples/widgets/codeeditor/doc/codeeditor.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-Code Editor Example
-===================
-
-The Code Editor example shows how to create a simple editor that has line
-numbers and that highlights the current line.
-
-.. image:: painter.png
- :width: 400
- :alt: Code Editor Screenshot
diff --git a/examples/widgets/codeeditor/main.py b/examples/widgets/codeeditor/main.py
deleted file mode 100644
index cffcca02c..000000000
--- a/examples/widgets/codeeditor/main.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-import sys
-from PySide6.QtWidgets import QApplication
-from codeeditor import CodeEditor
-
-"""PySide6 port of the widgets/codeeditor example from Qt5"""
-
-if __name__ == "__main__":
- app = QApplication([])
- editor = CodeEditor()
- editor.setWindowTitle("Code Editor Example")
- editor.show()
- sys.exit(app.exec())
diff --git a/examples/widgets/desktop/systray/window.py b/examples/widgets/desktop/systray/window.py
index c04a33e3a..0b5bc39dc 100644
--- a/examples/widgets/desktop/systray/window.py
+++ b/examples/widgets/desktop/systray/window.py
@@ -9,7 +9,7 @@ from PySide6.QtWidgets import (QCheckBox, QComboBox, QDialog,
QSpinBox, QStyle, QSystemTrayIcon, QTextEdit,
QVBoxLayout)
-import rc_systray
+import rc_systray # noqa: F401
class Window(QDialog):
@@ -190,8 +190,8 @@ class Window(QDialog):
self._body_label = QLabel("Body:")
self._body_edit = QTextEdit()
- self._body_edit.setPlainText("Don't believe me. Honestly, I don't have a clue."
- "\nClick this balloon for details.")
+ self._body_edit.setPlainText("Don't believe me. Honestly, I don't have a clue.\n"
+ "Click this balloon for details.")
self._show_message_button = QPushButton("Show Message")
self._show_message_button.setDefault(True)
@@ -222,7 +222,7 @@ class Window(QDialog):
self._restore_action.triggered.connect(self.showNormal)
self._quit_action = QAction("Quit", self)
- self._quit_action.triggered.connect(qApp.quit)
+ self._quit_action.triggered.connect(qApp.quit) # noqa: F821
def create_tray_icon(self):
self._tray_icon_menu = QMenu(self)
diff --git a/examples/widgets/dialogs/classwizard/classwizard.py b/examples/widgets/dialogs/classwizard/classwizard.py
index b657308e0..0efbde69f 100644
--- a/examples/widgets/dialogs/classwizard/classwizard.py
+++ b/examples/widgets/dialogs/classwizard/classwizard.py
@@ -13,9 +13,9 @@ from PySide6.QtWidgets import (QApplication, QComboBox, QCheckBox, QFormLayout,
QMessageBox, QToolButton, QVBoxLayout, QWizard,
QWizardPage)
-from listchooser import ListChooser, PropertyChooser, SignalChooser
+from listchooser import PropertyChooser, SignalChooser
-import classwizard_rc
+import classwizard_rc # noqa: F401
BASE_CLASSES = ['<None>', 'PySide6.QtCore.QObject',
@@ -333,7 +333,7 @@ class OutputFilesPage(QWizardPage):
def _choose_output_dir(self):
directory = QFileDialog.getExistingDirectory(self, "Output Directory",
- self.output_dir())
+ self.output_dir())
if directory:
self.set_output_dir(directory)
diff --git a/examples/widgets/dialogs/classwizard/classwizard.pyproject b/examples/widgets/dialogs/classwizard/classwizard.pyproject
index 6086099b8..fcc96ef28 100644
--- a/examples/widgets/dialogs/classwizard/classwizard.pyproject
+++ b/examples/widgets/dialogs/classwizard/classwizard.pyproject
@@ -1,4 +1,3 @@
{
- "files": ["classwizard.qrc", "classwizard.py", "classwizard_rc.py",
- "listchooser.py", "classwizard_rc.pyc"]
+ "files": ["classwizard.qrc", "classwizard.py", "listchooser.py"]
}
diff --git a/examples/widgets/dialogs/classwizard/listchooser.py b/examples/widgets/dialogs/classwizard/listchooser.py
index bf15be88c..6bf47c6d1 100644
--- a/examples/widgets/dialogs/classwizard/listchooser.py
+++ b/examples/widgets/dialogs/classwizard/listchooser.py
@@ -27,7 +27,7 @@ class ValidatingInputDialog(QDialog):
self._lineedit = QLineEdit()
self._lineedit.setClearButtonEnabled(True)
re = QRegularExpression(pattern)
- assert(re.isValid())
+ assert re.isValid()
self._validator = QRegularExpressionValidator(re, self)
self._lineedit.setValidator(self._validator)
self._form_layout.addRow(label, self._lineedit)
diff --git a/examples/widgets/dialogs/findfiles/findfiles.py b/examples/widgets/dialogs/findfiles/findfiles.py
deleted file mode 100644
index 7f2093c42..000000000
--- a/examples/widgets/dialogs/findfiles/findfiles.py
+++ /dev/null
@@ -1,184 +0,0 @@
-# Copyright (C) 2013 Riverbank Computing Limited.
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-"""PySide6 port of the widgets/dialogs/findfiles example from Qt v5.x"""
-
-import sys
-
-from PySide6.QtCore import (QCoreApplication, QDir, QFile, QFileInfo,
- QIODevice, QTextStream, QUrl, Qt)
-from PySide6.QtGui import QDesktopServices
-from PySide6.QtWidgets import (QAbstractItemView, QApplication, QComboBox,
- QDialog, QFileDialog, QGridLayout, QHBoxLayout,
- QHeaderView, QLabel, QProgressDialog,
- QPushButton, QSizePolicy, QTableWidget,
- QTableWidgetItem)
-
-
-class Window(QDialog):
- def __init__(self, parent=None):
- super().__init__(parent)
-
- self._browse_button = self.create_button("&Browse...", self.browse)
- self._find_button = self.create_button("&Find", self.find)
-
- self._file_combo_box = self.create_combo_box("*")
- self._text_combo_box = self.create_combo_box()
- self._directory_combo_box = self.create_combo_box(QDir.currentPath())
-
- file_label = QLabel("Named:")
- text_label = QLabel("Containing text:")
- directory_label = QLabel("In directory:")
- self._files_found_label = QLabel()
-
- self.create_files_table()
-
- buttons_layout = QHBoxLayout()
- buttons_layout.addStretch()
- buttons_layout.addWidget(self._find_button)
-
- main_layout = QGridLayout()
- main_layout.addWidget(file_label, 0, 0)
- main_layout.addWidget(self._file_combo_box, 0, 1, 1, 2)
- main_layout.addWidget(text_label, 1, 0)
- main_layout.addWidget(self._text_combo_box, 1, 1, 1, 2)
- main_layout.addWidget(directory_label, 2, 0)
- main_layout.addWidget(self._directory_combo_box, 2, 1)
- main_layout.addWidget(self._browse_button, 2, 2)
- main_layout.addWidget(self._files_table, 3, 0, 1, 3)
- main_layout.addWidget(self._files_found_label, 4, 0)
- main_layout.addLayout(buttons_layout, 5, 0, 1, 3)
- self.setLayout(main_layout)
-
- self.setWindowTitle("Find Files")
- self.resize(500, 300)
-
- def browse(self):
- directory = QFileDialog.getExistingDirectory(self, "Find Files",
- QDir.currentPath())
-
- if directory:
- if self._directory_combo_box.findText(directory) == -1:
- self._directory_combo_box.addItem(directory)
-
- self._directory_combo_box.setCurrentIndex(self._directory_combo_box.findText(directory))
-
- @staticmethod
- def update_combo_box(comboBox):
- if comboBox.findText(comboBox.currentText()) == -1:
- comboBox.addItem(comboBox.currentText())
-
- def find(self):
- self._files_table.setRowCount(0)
-
- file_name = self._file_combo_box.currentText()
- text = self._text_combo_box.currentText()
- path = self._directory_combo_box.currentText()
-
- self.update_combo_box(self._file_combo_box)
- self.update_combo_box(self._text_combo_box)
- self.update_combo_box(self._directory_combo_box)
-
- self._current_dir = QDir(path)
- if not file_name:
- file_name = "*"
- files = self._current_dir.entryList([file_name],
- QDir.Files | QDir.NoSymLinks)
-
- if text:
- files = self.find_files(files, text)
- self.show_files(files)
-
- def find_files(self, files, text):
- progress_dialog = QProgressDialog(self)
-
- progress_dialog.setCancelButtonText("&Cancel")
- progress_dialog.setRange(0, len(files))
- progress_dialog.setWindowTitle("Find Files")
-
- found_files = []
-
- for i in range(len(files)):
- progress_dialog.setValue(i)
- n = len(files)
- progress_dialog.setLabelText(f"Searching file number {i} of {n}...")
- QCoreApplication.processEvents()
-
- if progress_dialog.wasCanceled():
- break
-
- in_file = QFile(self._current_dir.absoluteFilePath(files[i]))
-
- if in_file.open(QIODevice.ReadOnly):
- stream = QTextStream(in_file)
- while not stream.atEnd():
- if progress_dialog.wasCanceled():
- break
- line = stream.readLine()
- if text in line:
- found_files.append(files[i])
- break
-
- progress_dialog.close()
-
- return found_files
-
- def show_files(self, files):
- for fn in files:
- file = QFile(self._current_dir.absoluteFilePath(fn))
- size = QFileInfo(file).size()
-
- file_name_item = QTableWidgetItem(fn)
- file_name_item.setFlags(file_name_item.flags() ^ Qt.ItemIsEditable)
- size_kb = int((size + 1023) / 1024)
- size_item = QTableWidgetItem(f"{size_kb} KB")
- size_item.setTextAlignment(Qt.AlignVCenter | Qt.AlignRight)
- size_item.setFlags(size_item.flags() ^ Qt.ItemIsEditable)
-
- row = self._files_table.rowCount()
- self._files_table.insertRow(row)
- self._files_table.setItem(row, 0, file_name_item)
- self._files_table.setItem(row, 1, size_item)
-
- n = len(files)
- self._files_found_label.setText(f"{n} file(s) found (Double click on a file to open it)")
-
- def create_button(self, text, member):
- button = QPushButton(text)
- button.clicked.connect(member)
- return button
-
- def create_combo_box(self, text=""):
- combo_box = QComboBox()
- combo_box.setEditable(True)
- combo_box.addItem(text)
- combo_box.setSizePolicy(QSizePolicy.Expanding,
- QSizePolicy.Preferred)
- return combo_box
-
- def create_files_table(self):
- self._files_table = QTableWidget(0, 2)
- self._files_table.setSelectionBehavior(QAbstractItemView.SelectRows)
-
- self._files_table.setHorizontalHeaderLabels(("File Name", "Size"))
- self._files_table.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
- self._files_table.verticalHeader().hide()
- self._files_table.setShowGrid(False)
-
- self._files_table.cellActivated.connect(self.open_file_of_item)
-
- def open_file_of_item(self, row, column):
- item = self._files_table.item(row, 0)
-
- QDesktopServices.openUrl(QUrl(self._current_dir.absoluteFilePath(item.text())))
-
-
-if __name__ == '__main__':
-
- import sys
-
- app = QApplication(sys.argv)
- window = Window()
- window.show()
- sys.exit(app.exec())
diff --git a/examples/widgets/dialogs/findfiles/findfiles.pyproject b/examples/widgets/dialogs/findfiles/findfiles.pyproject
deleted file mode 100644
index c2fae6dff..000000000
--- a/examples/widgets/dialogs/findfiles/findfiles.pyproject
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "files": ["findfiles.py"]
-}
diff --git a/examples/widgets/dialogs/standarddialogs/standarddialogs.py b/examples/widgets/dialogs/standarddialogs/standarddialogs.py
index 94a5eec52..ef677d5a8 100644
--- a/examples/widgets/dialogs/standarddialogs/standarddialogs.py
+++ b/examples/widgets/dialogs/standarddialogs/standarddialogs.py
@@ -5,6 +5,8 @@
"""PySide6 port of the widgets/dialogs/standarddialogs example from Qt v5.x"""
import sys
+from textwrap import dedent
+
from PySide6.QtCore import QDir, Qt, Slot
from PySide6.QtGui import QFont, QPalette
from PySide6.QtWidgets import (QApplication, QColorDialog, QCheckBox, QDialog,
@@ -37,10 +39,6 @@ class DialogOptionsWidget(QGroupBox):
class Dialog(QDialog):
- MESSAGE = ("<p>Message boxes have a caption, a text, and up to three "
- "buttons, each with standard or custom texts.</p>"
- "<p>Click a button to close the message box. Pressing the Esc "
- "button will activate the detected escape button (if any).</p>")
def __init__(self, parent=None):
super().__init__(parent)
@@ -143,8 +141,6 @@ class Dialog(QDialog):
self._warning_label.setFrameStyle(frame_style)
self._warning_button = QPushButton("QMessageBox.&warning()")
- self._error_label = QLabel()
- self._error_label.setFrameStyle(frame_style)
self._error_button = QPushButton("QErrorMessage.showM&essage()")
self._integer_button.clicked.connect(self.set_integer)
@@ -230,7 +226,6 @@ class Dialog(QDialog):
layout.addWidget(self._warning_button, 3, 0)
layout.addWidget(self._warning_label, 3, 1)
layout.addWidget(self._error_button, 4, 0)
- layout.addWidget(self._error_label, 4, 1)
spacer = QSpacerItem(0, 0, QSizePolicy.Ignored, QSizePolicy.MinimumExpanding)
layout.addItem(spacer, 5, 0)
toolbox.addItem(page, "Message Boxes")
@@ -240,14 +235,14 @@ class Dialog(QDialog):
@Slot()
def set_integer(self):
i, ok = QInputDialog.getInt(self,
- "QInputDialog.getInteger()", "Percentage:", 25, 0, 100, 1)
+ "QInputDialog.getInteger()", "Percentage:", 25, 0, 100, 1)
if ok:
self._integer_label.setText(f"{i}%")
@Slot()
def set_double(self):
d, ok = QInputDialog.getDouble(self, "QInputDialog.getDouble()",
- "Amount:", 37.56, -10000, 10000, 2)
+ "Amount:", 37.56, -10000, 10000, 2)
if ok:
self._double_label.setText(f"${d:g}")
@@ -255,23 +250,21 @@ class Dialog(QDialog):
def set_item(self):
items = ("Spring", "Summer", "Fall", "Winter")
- item, ok = QInputDialog.getItem(self, "QInputDialog.getItem()",
- "Season:", items, 0, False)
+ item, ok = QInputDialog.getItem(self, "QInputDialog.getItem()", "Season:", items, 0, False)
if ok and item:
self._item_label.setText(item)
@Slot()
def set_text(self):
text, ok = QInputDialog.getText(self, "QInputDialog.getText()",
- "User name:", QLineEdit.Normal,
- QDir.home().dirName())
+ "User name:", QLineEdit.Normal, QDir.home().dirName())
if ok and text != '':
self._text_label.setText(text)
@Slot()
def set_multiline_text(self):
text, ok = QInputDialog.getMultiLineText(self, "QInputDialog::getMultiLineText()",
- "Address:", "John Doe\nFreedom Street")
+ "Address:", "John Doe\nFreedom Street")
if ok and text != '':
self._multiline_text_label.setText(text)
@@ -306,9 +299,8 @@ class Dialog(QDialog):
options_value = self._file_options.value()
options = QFileDialog.Options(options_value) | QFileDialog.ShowDirsOnly
- directory = QFileDialog.getExistingDirectory(self,
- "QFileDialog.getExistingDirectory()",
- self._directory_label.text(), options)
+ directory = QFileDialog.getExistingDirectory(self, "QFileDialog.getExistingDirectory()",
+ self._directory_label.text(), options)
if directory:
self._directory_label.setText(directory)
@@ -317,10 +309,9 @@ class Dialog(QDialog):
options_value = self._file_options.value()
options = QFileDialog.Options(options_value)
- fileName, filtr = QFileDialog.getOpenFileName(self,
- "QFileDialog.getOpenFileName()",
- self._open_file_name_label.text(),
- "All Files (*);;Text Files (*.txt)", "", options)
+ fileName, _ = QFileDialog.getOpenFileName(self, "QFileDialog.getOpenFileName()",
+ self._open_file_name_label.text(),
+ "All Files (*);;Text Files (*.txt)", "", options)
if fileName:
self._open_file_name_label.setText(fileName)
@@ -329,9 +320,9 @@ class Dialog(QDialog):
options_value = self._file_options.value()
options = QFileDialog.Options(options_value)
- files, filtr = QFileDialog.getOpenFileNames(self,
- "QFileDialog.getOpenFileNames()", self._open_files_path,
- "All Files (*);;Text Files (*.txt)", "", options)
+ files, _ = QFileDialog.getOpenFileNames(self, "QFileDialog.getOpenFileNames()",
+ self._open_files_path,
+ "All Files (*);;Text Files (*.txt)", "", options)
if files:
self._open_files_path = files[0]
file_list = ', '.join(files)
@@ -342,18 +333,24 @@ class Dialog(QDialog):
options_value = self._file_options.value()
options = QFileDialog.Options(options_value)
- fileName, filtr = QFileDialog.getSaveFileName(self,
- "QFileDialog.getSaveFileName()",
- self._save_file_name_label.text(),
- "All Files (*);;Text Files (*.txt)", "", options)
+ fileName, _ = QFileDialog.getSaveFileName(self, "QFileDialog.getSaveFileName()",
+ self._save_file_name_label.text(),
+ "All Files (*);;Text Files (*.txt)", "", options)
if fileName:
self._save_file_name_label.setText(fileName)
@Slot()
def critical_message(self):
- reply = QMessageBox.critical(self, "QMessageBox.critical()",
- Dialog.MESSAGE,
- QMessageBox.Abort | QMessageBox.Retry | QMessageBox.Ignore)
+ m = dedent("""\
+ Activating the liquid oxygen stirring fans caused an
+ explosion in one of the tanks. Liquid oxygen levels
+ are getting low. This may jeopardize the moon landing mission.""")
+ msg_box = QMessageBox(QMessageBox.Critical, "QMessageBox.critical()",
+ "Houston, we have a problem",
+ QMessageBox.Abort | QMessageBox.Retry | QMessageBox.Ignore,
+ self)
+ msg_box.setInformativeText(m)
+ reply = msg_box.exec()
if reply == QMessageBox.Abort:
self._critical_label.setText("Abort")
elif reply == QMessageBox.Retry:
@@ -363,8 +360,16 @@ class Dialog(QDialog):
@Slot()
def information_message(self):
- reply = QMessageBox.information(self,
- "QMessageBox.information()", Dialog.MESSAGE)
+ m = dedent("""\
+ This phrase was often used by public address announcers at
+ the conclusion of Elvis Presley concerts in order to
+ disperse audiences who lingered in hopes of an encore.
+ It has since become a catchphrase and punchline.""")
+ msg_box = QMessageBox(QMessageBox.Information, "QMessageBox.information()",
+ "Elvis has left the building.",
+ QMessageBox.Ok, self)
+ msg_box.setInformativeText(m)
+ reply = msg_box.exec()
if reply == QMessageBox.Ok:
self._information_label.setText("OK")
else:
@@ -372,9 +377,17 @@ class Dialog(QDialog):
@Slot()
def question_message(self):
- reply = QMessageBox.question(self, "QMessageBox.question()",
- Dialog.MESSAGE,
- QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
+ m = dedent("""\
+ A cheeseburger is a hamburger topped with cheese.
+ Traditionally, the slice of cheese is placed on top of the
+ meat patty. The cheese is usually added to the cooking
+ hamburger patty shortly before serving, which allows the
+ cheese to melt.""")
+ msg_box = QMessageBox(QMessageBox.Question, "QMessageBox.question()",
+ "Would you like cheese with that?",
+ QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
+ msg_box.setInformativeText(m)
+ reply = msg_box.exec()
if reply == QMessageBox.Yes:
self._question_label.setText("Yes")
elif reply == QMessageBox.No:
@@ -384,25 +397,34 @@ class Dialog(QDialog):
@Slot()
def warning_message(self):
- msg_box = QMessageBox(QMessageBox.Warning,
- "QMessageBox.warning()", Dialog.MESSAGE,
- QMessageBox.NoButton, self)
- msg_box.addButton("Save &Again", QMessageBox.AcceptRole)
- msg_box.addButton("&Continue", QMessageBox.RejectRole)
+ msg_box = QMessageBox(QMessageBox.Warning, "QMessageBox.warning()",
+ "Delete the only copy of your movie manuscript?",
+ QMessageBox.NoButton, self)
+ m = "You've been working on this manuscript for 738 days now. Hang in there!"
+ msg_box.setInformativeText(m)
+ msg_box.setDetailedText('"A long time ago in a galaxy far, far away...."')
+ msg_box.addButton("&Keep", QMessageBox.AcceptRole)
+ msg_box.addButton("Delete", QMessageBox.RejectRole)
if msg_box.exec() == QMessageBox.AcceptRole:
- self._warning_label.setText("Save Again")
+ self._warning_label.setText("Keep")
else:
- self._warning_label.setText("Continue")
+ self._warning_label.setText("Delete")
@Slot()
def error_message(self):
- self._error_message_dialog.showMessage("This dialog shows and remembers "
- "error messages. If the checkbox is checked (as it is by "
- "default), the shown message will be shown again, but if the "
- "user unchecks the box the message will not appear again if "
- "QErrorMessage.showMessage() is called with the same message.")
- self._error_label.setText("If the box is unchecked, the message won't "
- "appear again.")
+ m = dedent("""\
+ This dialog shows and remembers error messages. If the
+ user chooses to not show the dialog again, the dialog
+ will not appear again if QErrorMessage.showMessage()
+ is called with the same message.""")
+ self._error_message_dialog.showMessage(m)
+ m = dedent("""\
+ You can queue up error messages, and they will be
+ shown one after each other. Each message maintains
+ its own state for whether it will be shown again
+ the next time QErrorMessage::showMessage() is called
+ with the same message.""")
+ self._error_message_dialog.showMessage(m)
if __name__ == '__main__':
diff --git a/examples/widgets/dialogs/trivialwizard/trivialwizard.py b/examples/widgets/dialogs/trivialwizard/trivialwizard.py
index 0eb9fb567..2e551ae19 100644
--- a/examples/widgets/dialogs/trivialwizard/trivialwizard.py
+++ b/examples/widgets/dialogs/trivialwizard/trivialwizard.py
@@ -15,7 +15,7 @@ def create_intro_page():
page.setTitle("Introduction")
label = QLabel("This wizard will help you register your copy of "
- "Super Product Two.")
+ "Super Product Two.")
label.setWordWrap(True)
layout = QVBoxLayout(page)
diff --git a/examples/widgets/draganddrop/draggabletext/draggabletext.py b/examples/widgets/draganddrop/draggabletext/draggabletext.py
index 4b470cc9d..6ffdbd70e 100644
--- a/examples/widgets/draganddrop/draggabletext/draggabletext.py
+++ b/examples/widgets/draganddrop/draggabletext/draggabletext.py
@@ -2,13 +2,14 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-"""PySide6 port of the widgets/draganddrop/draggabletext example from Qt v5.x, originating from PyQt"""
+"""PySide6 port of the widgets/draganddrop/draggabletext example from Qt v5.x,
+ originating from PyQt"""
from PySide6.QtCore import QFile, QIODevice, QMimeData, QPoint, Qt, QTextStream
from PySide6.QtGui import QDrag, QPalette, QPixmap
from PySide6.QtWidgets import QApplication, QFrame, QLabel, QWidget
-import draggabletext_rc
+import draggabletext_rc # noqa: F401
class DragLabel(QLabel):
diff --git a/examples/widgets/draganddrop/draggabletext/draggabletext.pyproject b/examples/widgets/draganddrop/draggabletext/draggabletext.pyproject
index 0d422076e..fd97c9096 100644
--- a/examples/widgets/draganddrop/draggabletext/draggabletext.pyproject
+++ b/examples/widgets/draganddrop/draggabletext/draggabletext.pyproject
@@ -1,4 +1,3 @@
{
- "files": ["draggabletext_rc.py", "words.txt", "draggabletext.qrc",
- "draggabletext.py"]
+ "files": ["words.txt", "draggabletext.qrc", "draggabletext.py"]
}
diff --git a/examples/widgets/effects/lighting/lighting.py b/examples/widgets/effects/lighting/lighting.py
index fe200357d..f074813c3 100644
--- a/examples/widgets/effects/lighting/lighting.py
+++ b/examples/widgets/effects/lighting/lighting.py
@@ -37,8 +37,7 @@ class Lighting(QGraphicsView):
def setup_scene(self):
self.m_scene.setSceneRect(-300, -200, 600, 460)
- linear_grad = QLinearGradient(QPointF(-100, -100),
- QPointF(100, 100))
+ linear_grad = QLinearGradient(QPointF(-100, -100), QPointF(100, 100))
linear_grad.setColorAt(0, QColor(255, 255, 255))
linear_grad.setColorAt(1, QColor(192, 192, 255))
self.setBackgroundBrush(linear_grad)
diff --git a/examples/widgets/gettext/doc/gettext.rst b/examples/widgets/gettext/doc/gettext.rst
new file mode 100644
index 000000000..ea1127fe7
--- /dev/null
+++ b/examples/widgets/gettext/doc/gettext.rst
@@ -0,0 +1,7 @@
+.. _gettext-example:
+
+GNU gettext Example
+===================
+
+This example demonstrates the use of GNU gettext for translating
+applications as described in :ref:`translations`.
diff --git a/examples/widgets/graphicsview/anchorlayout/anchorlayout.py b/examples/widgets/graphicsview/anchorlayout/anchorlayout.py
index d6e8e57b2..9d9be041f 100644
--- a/examples/widgets/graphicsview/anchorlayout/anchorlayout.py
+++ b/examples/widgets/graphicsview/anchorlayout/anchorlayout.py
@@ -41,7 +41,7 @@ if __name__ == '__main__':
f = create_item(QSizeF(30, 50), QSizeF(150, 50), max_size, "F")
g = create_item(QSizeF(30, 50), QSizeF(30, 100), max_size, "G")
- l = QGraphicsAnchorLayout()
+ l = QGraphicsAnchorLayout() # noqa: E741
l.setSpacing(0)
w = QGraphicsWidget(None, Qt.Window)
diff --git a/examples/widgets/graphicsview/collidingmice/collidingmice.py b/examples/widgets/graphicsview/collidingmice/collidingmice.py
index 53c5c1aab..fb24db3ab 100644
--- a/examples/widgets/graphicsview/collidingmice/collidingmice.py
+++ b/examples/widgets/graphicsview/collidingmice/collidingmice.py
@@ -5,14 +5,11 @@
import math
import sys
-from PySide6.QtCore import (QLineF, QPointF, QRandomGenerator, QRectF, QTimer,
- Qt)
-from PySide6.QtGui import (QBrush, QColor, QPainter, QPainterPath, QPixmap,
- QPolygonF, QTransform)
-from PySide6.QtWidgets import (QApplication, QGraphicsItem, QGraphicsScene,
- QGraphicsView)
+from PySide6.QtCore import (QLineF, QPointF, QRandomGenerator, QRectF, QTimer, Qt)
+from PySide6.QtGui import (QBrush, QColor, QPainter, QPainterPath, QPixmap, QPolygonF, QTransform)
+from PySide6.QtWidgets import (QApplication, QGraphicsItem, QGraphicsScene, QGraphicsView)
-import mice_rc
+import mice_rc # noqa: F401
def random(boundary):
@@ -26,7 +23,7 @@ class Mouse(QGraphicsItem):
# Create the bounding rectangle once.
adjust = 0.5
BOUNDING_RECT = QRectF(-20 - adjust, -22 - adjust, 40 + adjust,
- 83 + adjust)
+ 83 + adjust)
def __init__(self):
super().__init__()
@@ -103,7 +100,8 @@ class Mouse(QGraphicsItem):
if angle_to_center < Mouse.PI and angle_to_center > Mouse.PI / 4:
# Rotate left.
self.angle += [-0.25, 0.25][self.angle < -Mouse.PI / 2]
- elif angle_to_center >= Mouse.PI and angle_to_center < (Mouse.PI + Mouse.PI / 2 + Mouse.PI / 4):
+ elif (angle_to_center >= Mouse.PI
+ and angle_to_center < (Mouse.PI + Mouse.PI / 2 + Mouse.PI / 4)):
# Rotate right.
self.angle += [-0.25, 0.25][self.angle < Mouse.PI / 2]
elif math.sin(self.angle) < 0:
diff --git a/examples/widgets/graphicsview/collidingmice/collidingmice.pyproject b/examples/widgets/graphicsview/collidingmice/collidingmice.pyproject
index ea5821866..621bfd642 100644
--- a/examples/widgets/graphicsview/collidingmice/collidingmice.pyproject
+++ b/examples/widgets/graphicsview/collidingmice/collidingmice.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["collidingmice.py", "mice_rc.py"]
+ "files": ["collidingmice.py"]
}
diff --git a/examples/widgets/graphicsview/diagramscene/diagramscene.py b/examples/widgets/graphicsview/diagramscene/diagramscene.py
index ea39cf938..60e05613c 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramscene.py
+++ b/examples/widgets/graphicsview/diagramscene/diagramscene.py
@@ -17,7 +17,7 @@ from PySide6.QtWidgets import (QAbstractButton, QApplication, QButtonGroup,
QMessageBox, QSizePolicy, QToolBox, QToolButton,
QWidget)
-import diagramscene_rc
+import diagramscene_rc # noqa: F401
class Arrow(QGraphicsLineItem):
@@ -30,8 +30,7 @@ class Arrow(QGraphicsLineItem):
self._my_end_item = endItem
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
self._my_color = Qt.black
- self.setPen(QPen(self._my_color, 2, Qt.SolidLine,
- Qt.RoundCap, Qt.RoundJoin))
+ self.setPen(QPen(self._my_color, 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin))
def set_color(self, color):
self._my_color = color
@@ -163,19 +162,19 @@ class DiagramItem(QGraphicsPolygonItem):
self._my_polygon = path.toFillPolygon()
elif self.diagram_type == self.Conditional:
self._my_polygon = QPolygonF([
- QPointF(-100, 0), QPointF(0, 100),
- QPointF(100, 0), QPointF(0, -100),
- QPointF(-100, 0)])
+ QPointF(-100, 0), QPointF(0, 100),
+ QPointF(100, 0), QPointF(0, -100),
+ QPointF(-100, 0)])
elif self.diagram_type == self.Step:
self._my_polygon = QPolygonF([
- QPointF(-100, -100), QPointF(100, -100),
- QPointF(100, 100), QPointF(-100, 100),
- QPointF(-100, -100)])
+ QPointF(-100, -100), QPointF(100, -100),
+ QPointF(100, 100), QPointF(-100, 100),
+ QPointF(-100, -100)])
else:
self._my_polygon = QPolygonF([
- QPointF(-120, -80), QPointF(-70, 80),
- QPointF(120, 80), QPointF(70, -80),
- QPointF(-120, -80)])
+ QPointF(-120, -80), QPointF(-70, 80),
+ QPointF(120, 80), QPointF(70, -80),
+ QPointF(-120, -80)])
self.setPolygon(self._my_polygon)
self.setFlag(QGraphicsItem.ItemIsMovable, True)
@@ -291,8 +290,7 @@ class DiagramScene(QGraphicsScene):
item.setPos(mouseEvent.scenePos())
self.item_inserted.emit(item)
elif self._my_mode == self.InsertLine:
- self.line = QGraphicsLineItem(QLineF(mouseEvent.scenePos(),
- mouseEvent.scenePos()))
+ self.line = QGraphicsLineItem(QLineF(mouseEvent.scenePos(), mouseEvent.scenePos()))
self.line.setPen(QPen(self._my_line_color, 2))
self.addItem(self.line)
elif self._my_mode == self.InsertText:
@@ -328,10 +326,10 @@ class DiagramScene(QGraphicsScene):
self.removeItem(self.line)
self.line = None
- if (len(start_items) and len(end_items) and
- isinstance(start_items[0], DiagramItem) and
- isinstance(end_items[0], DiagramItem) and
- start_items[0] != end_items[0]):
+ if (len(start_items) and len(end_items)
+ and isinstance(start_items[0], DiagramItem)
+ and isinstance(end_items[0], DiagramItem)
+ and start_items[0] != end_items[0]):
start_item = start_items[0]
end_item = end_items[0]
arrow = Arrow(start_item, end_item)
@@ -484,24 +482,21 @@ class MainWindow(QMainWindow):
def text_color_changed(self):
self._text_action = self.sender()
self._font_color_tool_button.setIcon(self.create_color_tool_button_icon(
- ':/images/textpointer.png',
- QColor(self._text_action.data())))
+ ':/images/textpointer.png', QColor(self._text_action.data())))
self.text_button_triggered()
@Slot()
def item_color_changed(self):
self._fill_action = self.sender()
self._fill_color_tool_button.setIcon(self.create_color_tool_button_icon(
- ':/images/floodfill.png',
- QColor(self._fill_action.data())))
+ ':/images/floodfill.png', QColor(self._fill_action.data())))
self.fill_button_triggered()
@Slot()
def line_color_changed(self):
self._line_action = self.sender()
self._line_color_tool_button.setIcon(self.create_color_tool_button_icon(
- ':/images/linecolor.png',
- QColor(self._line_action.data())))
+ ':/images/linecolor.png', QColor(self._line_action.data())))
self.line_button_triggered()
@Slot()
@@ -532,7 +527,6 @@ class MainWindow(QMainWindow):
@Slot(QGraphicsItem)
def item_selected(self, item):
font = item.font()
- color = item.defaultTextColor()
self._font_combo.setCurrentFont(font)
self._font_size_combo.setEditText(str(font.pointSize()))
self._bold_action.setChecked(font.weight() == QFont.Bold)
@@ -542,7 +536,7 @@ class MainWindow(QMainWindow):
@Slot()
def about(self):
QMessageBox.about(self, "About Diagram Scene",
- "The <b>Diagram Scene</b> example shows use of the graphics framework.")
+ "The <b>Diagram Scene</b> example shows use of the graphics framework.")
def create_tool_box(self):
self._button_group = QButtonGroup()
@@ -550,12 +544,9 @@ class MainWindow(QMainWindow):
self._button_group.idClicked.connect(self.button_group_clicked)
layout = QGridLayout()
- layout.addWidget(self.create_cell_widget("Conditional", DiagramItem.Conditional),
- 0, 0)
- layout.addWidget(self.create_cell_widget("Process", DiagramItem.Step), 0,
- 1)
- layout.addWidget(self.create_cell_widget("Input/Output", DiagramItem.Io),
- 1, 0)
+ layout.addWidget(self.create_cell_widget("Conditional", DiagramItem.Conditional), 0, 0)
+ layout.addWidget(self.create_cell_widget("Process", DiagramItem.Step), 0, 1)
+ layout.addWidget(self.create_cell_widget("Input/Output", DiagramItem.Io), 1, 0)
text_button = QToolButton()
text_button.setCheckable(True)
@@ -581,14 +572,14 @@ class MainWindow(QMainWindow):
self._background_button_group.buttonClicked.connect(self.background_button_group_clicked)
background_layout = QGridLayout()
- background_layout.addWidget(self.create_background_cell_widget("Blue Grid",
- ':/images/background1.png'), 0, 0)
- background_layout.addWidget(self.create_background_cell_widget("White Grid",
- ':/images/background2.png'), 0, 1)
- background_layout.addWidget(self.create_background_cell_widget("Gray Grid",
- ':/images/background3.png'), 1, 0)
- background_layout.addWidget(self.create_background_cell_widget("No Grid",
- ':/images/background4.png'), 1, 1)
+ background_layout.addWidget(
+ self.create_background_cell_widget("Blue Grid", ':/images/background1.png'), 0, 0)
+ background_layout.addWidget(
+ self.create_background_cell_widget("White Grid", ':/images/background2.png'), 0, 1)
+ background_layout.addWidget(
+ self.create_background_cell_widget("Gray Grid", ':/images/background3.png'), 1, 0)
+ background_layout.addWidget(
+ self.create_background_cell_widget("No Grid", ':/images/background4.png'), 1, 1)
background_layout.setRowStretch(2, 10)
background_layout.setColumnStretch(2, 10)
@@ -604,38 +595,37 @@ class MainWindow(QMainWindow):
def create_actions(self):
self._to_front_action = QAction(
- QIcon(':/images/bringtofront.png'), "Bring to &Front",
- self, shortcut="Ctrl+F", statusTip="Bring item to front",
- triggered=self.bring_to_front)
+ QIcon(':/images/bringtofront.png'), "Bring to &Front",
+ self, shortcut="Ctrl+F", statusTip="Bring item to front",
+ triggered=self.bring_to_front)
self._send_back_action = QAction(
- QIcon(':/images/sendtoback.png'), "Send to &Back", self,
- shortcut="Ctrl+B", statusTip="Send item to back",
- triggered=self.send_to_back)
+ QIcon(':/images/sendtoback.png'), "Send to &Back", self,
+ shortcut="Ctrl+B", statusTip="Send item to back",
+ triggered=self.send_to_back)
self._delete_action = QAction(QIcon(':/images/delete.png'),
- "&Delete", self, shortcut="Delete",
- statusTip="Delete item from diagram",
- triggered=self.delete_item)
+ "&Delete", self, shortcut="Delete",
+ statusTip="Delete item from diagram",
+ triggered=self.delete_item)
self._exit_action = QAction("E&xit", self, shortcut="Ctrl+X",
- statusTip="Quit Scenediagram example", triggered=self.close)
+ statusTip="Quit Scenediagram example", triggered=self.close)
self._bold_action = QAction(QIcon(':/images/bold.png'),
- "Bold", self, checkable=True, shortcut="Ctrl+B",
- triggered=self.handle_font_change)
+ "Bold", self, checkable=True, shortcut="Ctrl+B",
+ triggered=self.handle_font_change)
self._italic_action = QAction(QIcon(':/images/italic.png'),
- "Italic", self, checkable=True, shortcut="Ctrl+I",
- triggered=self.handle_font_change)
+ "Italic", self, checkable=True, shortcut="Ctrl+I",
+ triggered=self.handle_font_change)
self._underline_action = QAction(
- QIcon(':/images/underline.png'), "Underline", self,
- checkable=True, shortcut="Ctrl+U",
- triggered=self.handle_font_change)
+ QIcon(':/images/underline.png'), "Underline", self,
+ checkable=True, shortcut="Ctrl+U",
+ triggered=self.handle_font_change)
- self._about_action = QAction("A&bout", self, shortcut="Ctrl+B",
- triggered=self.about)
+ self._about_action = QAction("A&bout", self, shortcut="Ctrl+B", triggered=self.about)
def create_menus(self):
self._file_menu = self.menuBar().addMenu("&File")
@@ -670,32 +660,29 @@ class MainWindow(QMainWindow):
self._font_color_tool_button = QToolButton()
self._font_color_tool_button.setPopupMode(QToolButton.MenuButtonPopup)
self._font_color_tool_button.setMenu(
- self.create_color_menu(self.text_color_changed, Qt.black))
+ self.create_color_menu(self.text_color_changed, Qt.black))
self._text_action = self._font_color_tool_button.menu().defaultAction()
self._font_color_tool_button.setIcon(
- self.create_color_tool_button_icon(':/images/textpointer.png',
- Qt.black))
+ self.create_color_tool_button_icon(':/images/textpointer.png', Qt.black))
self._font_color_tool_button.setAutoFillBackground(True)
self._font_color_tool_button.clicked.connect(self.text_button_triggered)
self._fill_color_tool_button = QToolButton()
self._fill_color_tool_button.setPopupMode(QToolButton.MenuButtonPopup)
self._fill_color_tool_button.setMenu(
- self.create_color_menu(self.item_color_changed, Qt.white))
+ self.create_color_menu(self.item_color_changed, Qt.white))
self._fill_action = self._fill_color_tool_button.menu().defaultAction()
self._fill_color_tool_button.setIcon(
- self.create_color_tool_button_icon(':/images/floodfill.png',
- Qt.white))
+ self.create_color_tool_button_icon(':/images/floodfill.png', Qt.white))
self._fill_color_tool_button.clicked.connect(self.fill_button_triggered)
self._line_color_tool_button = QToolButton()
self._line_color_tool_button.setPopupMode(QToolButton.MenuButtonPopup)
self._line_color_tool_button.setMenu(
- self.create_color_menu(self.line_color_changed, Qt.black))
+ self.create_color_menu(self.line_color_changed, Qt.black))
self._line_action = self._line_color_tool_button.menu().defaultAction()
self._line_color_tool_button.setIcon(
- self.create_color_tool_button_icon(':/images/linecolor.png',
- Qt.black))
+ self.create_color_tool_button_icon(':/images/linecolor.png', Qt.black))
self._line_color_tool_button.clicked.connect(self.line_button_triggered)
self._text_tool_bar = self.addToolBar("Font")
@@ -720,8 +707,7 @@ class MainWindow(QMainWindow):
self._pointer_type_group = QButtonGroup()
self._pointer_type_group.addButton(pointer_button, DiagramScene.MoveItem)
- self._pointer_type_group.addButton(line_pointer_button,
- DiagramScene.InsertLine)
+ self._pointer_type_group.addButton(line_pointer_button, DiagramScene.InsertLine)
self._pointer_type_group.idClicked.connect(self.pointer_group_clicked)
self._scene_scale_combo = QComboBox()
@@ -776,8 +762,7 @@ class MainWindow(QMainWindow):
color_menu = QMenu(self)
for color, name in zip(colors, names):
- action = QAction(self.create_color_icon(color), name, self,
- triggered=slot)
+ action = QAction(self.create_color_icon(color), name, self, triggered=slot)
action.setData(QColor(color))
color_menu.addAction(action)
if color == defaultColor:
diff --git a/examples/widgets/graphicsview/diagramscene/diagramscene.pyproject b/examples/widgets/graphicsview/diagramscene/diagramscene.pyproject
index 0acabdd78..79b8c8658 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramscene.pyproject
+++ b/examples/widgets/graphicsview/diagramscene/diagramscene.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["diagramscene.qrc", "diagramscene.py", "diagramscene_rc.py"]
+ "files": ["diagramscene.qrc", "diagramscene.py"]
}
diff --git a/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py b/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py
index 0bfd3e0db..9ed92b26e 100644
--- a/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py
+++ b/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.py
@@ -13,7 +13,7 @@ from PySide6.QtWidgets import (QApplication, QGraphicsItem,
QGraphicsItemAnimation, QGraphicsScene,
QGraphicsView)
-import dragdroprobot_rc
+import dragdroprobot_rc # noqa: F401
def random(boundary):
@@ -103,8 +103,8 @@ class RobotPart(QGraphicsItem):
self.setAcceptDrops(True)
def dragEnterEvent(self, event):
- if (event.mimeData().hasColor() or
- (isinstance(self, RobotHead) and event.mimeData().hasImage())):
+ if (event.mimeData().hasColor()
+ or (isinstance(self, RobotHead) and event.mimeData().hasImage())):
event.setAccepted(True)
self._drag_over = True
self.update()
@@ -131,8 +131,7 @@ class RobotHead(RobotPart):
def paint(self, painter, option, widget=None):
if not self.pixmap:
- painter.setBrush(self._drag_over and self.color.lighter(130)
- or self.color)
+ painter.setBrush(self._drag_over and self.color.lighter(130) or self.color)
painter.drawRoundedRect(-10, -30, 20, 30, 25, 25, Qt.RelativeSize)
painter.setBrush(Qt.white)
painter.drawEllipse(-7, -3 - 20, 7, 7)
@@ -154,7 +153,7 @@ class RobotTorso(RobotPart):
def paint(self, painter, option, widget=None):
painter.setBrush(self._drag_over and self.color.lighter(130)
- or self.color)
+ or self.color)
painter.drawRoundedRect(-20, -20, 40, 60, 25, 25, Qt.RelativeSize)
painter.drawEllipse(-25, -20, 20, 20)
painter.drawEllipse(5, -20, 20, 20)
@@ -169,7 +168,7 @@ class RobotLimb(RobotPart):
def paint(self, painter, option, widget=None):
painter.setBrush(self._drag_over and self.color.lighter(130) or self.color)
painter.drawRoundedRect(self.boundingRect(), 50, 50,
- Qt.RelativeSize)
+ Qt.RelativeSize)
painter.drawEllipse(-5, -5, 10, 10)
@@ -177,35 +176,35 @@ class Robot(RobotPart):
def __init__(self):
super().__init__()
- self.torsoItem = RobotTorso(self)
- self.headItem = RobotHead(self.torsoItem)
- self.upperLeftArmItem = RobotLimb(self.torsoItem)
- self.lowerLeftArmItem = RobotLimb(self.upperLeftArmItem)
+ self.torsoItem = RobotTorso(self)
+ self.headItem = RobotHead(self.torsoItem)
+ self.upperLeftArmItem = RobotLimb(self.torsoItem)
+ self.lowerLeftArmItem = RobotLimb(self.upperLeftArmItem)
self._upper_right_arm_item = RobotLimb(self.torsoItem)
self._lower_right_arm_item = RobotLimb(self._upper_right_arm_item)
self._upper_right_leg_item = RobotLimb(self.torsoItem)
self._lower_right_leg_item = RobotLimb(self._upper_right_leg_item)
- self.upperLeftLegItem = RobotLimb(self.torsoItem)
- self.lowerLeftLegItem = RobotLimb(self.upperLeftLegItem)
+ self.upperLeftLegItem = RobotLimb(self.torsoItem)
+ self.lowerLeftLegItem = RobotLimb(self.upperLeftLegItem)
self.timeline = QTimeLine()
settings = [
- # item position rotation at
- # x y time 0 / 1
- ( self.headItem, 0, -18, 20, -20 ),
- ( self.upperLeftArmItem, -15, -10, 190, 180 ),
- ( self.lowerLeftArmItem, 30, 0, 50, 10 ),
- ( self._upper_right_arm_item, 15, -10, 300, 310 ),
- ( self._lower_right_arm_item, 30, 0, 0, -70 ),
- ( self._upper_right_leg_item, 10, 32, 40, 120 ),
- ( self._lower_right_leg_item, 30, 0, 10, 50 ),
- ( self.upperLeftLegItem, -10, 32, 150, 80 ),
- ( self.lowerLeftLegItem, 30, 0, 70, 10 ),
- ( self.torsoItem, 0, 0, 5, -20 )
+ # item position rotation at
+ # x y time 0 / 1
+ (self.headItem, 0, -18, 20, -20), # noqa: E241
+ (self.upperLeftArmItem, -15, -10, 190, 180), # noqa: E241
+ (self.lowerLeftArmItem, 30, 0, 50, 10), # noqa: E241
+ (self._upper_right_arm_item, 15, -10, 300, 310), # noqa: E241
+ (self._lower_right_arm_item, 30, 0, 0, -70), # noqa: E241
+ (self._upper_right_leg_item, 10, 32, 40, 120), # noqa: E241
+ (self._lower_right_leg_item, 30, 0, 10, 50), # noqa: E241
+ (self.upperLeftLegItem, -10, 32, 150, 80), # noqa: E241
+ (self.lowerLeftLegItem, 30, 0, 70, 10), # noqa: E241
+ (self.torsoItem, 0, 0, 5, -20) # noqa: E241
]
self.animations = []
for item, pos_x, pos_y, rotation1, rotation2 in settings:
- item.setPos(pos_x,pos_y)
+ item.setPos(pos_x, pos_y)
animation = QGraphicsItemAnimation()
animation.setItem(item)
animation.setTimeLine(self.timeline)
@@ -228,7 +227,7 @@ class Robot(RobotPart):
pass
-if __name__== '__main__':
+if __name__ == '__main__':
app = QApplication(sys.argv)
scene = QGraphicsScene(-200, -200, 400, 400)
diff --git a/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pyproject b/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pyproject
index 587484a97..f31851b91 100644
--- a/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pyproject
+++ b/examples/widgets/graphicsview/dragdroprobot/dragdroprobot.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["dragdroprobot.qrc", "dragdroprobot_rc.py", "dragdroprobot.py"]
+ "files": ["dragdroprobot.qrc", "dragdroprobot.py"]
}
diff --git a/examples/widgets/graphicsview/elasticnodes/elasticnodes.py b/examples/widgets/graphicsview/elasticnodes/elasticnodes.py
index 58d9d4a90..90cb49626 100644
--- a/examples/widgets/graphicsview/elasticnodes/elasticnodes.py
+++ b/examples/widgets/graphicsview/elasticnodes/elasticnodes.py
@@ -20,8 +20,6 @@ def random(boundary):
class Edge(QGraphicsItem):
- item_type = QGraphicsItem.UserType + 2
-
def __init__(self, sourceNode, destNode):
super().__init__()
@@ -36,7 +34,7 @@ class Edge(QGraphicsItem):
self.adjust()
def item_type(self):
- return Edge.item_type
+ return QGraphicsItem.UserType + 2
def source_node(self):
return self.source()
@@ -119,7 +117,6 @@ class Edge(QGraphicsItem):
class Node(QGraphicsItem):
- item_type = QGraphicsItem.UserType + 1
def __init__(self, graphWidget):
super().__init__()
@@ -133,7 +130,7 @@ class Node(QGraphicsItem):
self.setZValue(-1)
def item_type(self):
- return Node.item_type
+ return QGraphicsItem.UserType + 1
def add_edge(self, edge):
self._edge_list.append(weakref.ref(edge))
@@ -157,7 +154,7 @@ class Node(QGraphicsItem):
line = QLineF(self.mapFromItem(item, 0, 0), QPointF(0, 0))
dx = line.dx()
dy = line.dy()
- l = 2.0 * (dx * dx + dy * dy)
+ l = 2.0 * (dx * dx + dy * dy) # noqa: E741
if l > 0:
xvel += (dx * 150.0) / l
yvel += (dy * 150.0) / l
@@ -192,7 +189,7 @@ class Node(QGraphicsItem):
def boundingRect(self):
adjust = 2.0
return QRectF(-10 - adjust, -10 - adjust,
- 23 + adjust, 23 + adjust)
+ 23 + adjust, 23 + adjust)
def shape(self):
path = QPainterPath()
@@ -348,9 +345,9 @@ class GraphWidget(QGraphicsView):
bottom_shadow = QRectF(scene_rect.left() + 5, scene_rect.bottom(),
scene_rect.width(), 5)
if right_shadow.intersects(rect) or right_shadow.contains(rect):
- painter.fillRect(right_shadow, Qt.darkGray)
+ painter.fillRect(right_shadow, Qt.darkGray)
if bottom_shadow.intersects(rect) or bottom_shadow.contains(rect):
- painter.fillRect(bottom_shadow, Qt.darkGray)
+ painter.fillRect(bottom_shadow, Qt.darkGray)
# Fill.
gradient = QLinearGradient(scene_rect.topLeft(), scene_rect.bottomRight())
@@ -362,7 +359,7 @@ class GraphWidget(QGraphicsView):
# Text.
text_rect = QRectF(scene_rect.left() + 4, scene_rect.top() + 4,
- scene_rect.width() - 4, scene_rect.height() - 4)
+ scene_rect.width() - 4, scene_rect.height() - 4)
message = self.tr("Click and drag the nodes around, and zoom with the "
"mouse wheel or the '+' and '-' keys")
@@ -376,7 +373,8 @@ class GraphWidget(QGraphicsView):
painter.drawText(text_rect, message)
def scale_view(self, scaleFactor):
- factor = self.transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width()
+ factor = self.transform().scale(scaleFactor, scaleFactor).mapRect(
+ QRectF(0, 0, 1, 1)).width()
if factor < 0.07 or factor > 100:
return
diff --git a/examples/widgets/imageviewer/imageviewer.py b/examples/widgets/imageviewer/imageviewer.py
index ded7f246a..93b1e87ba 100644
--- a/examples/widgets/imageviewer/imageviewer.py
+++ b/examples/widgets/imageviewer/imageviewer.py
@@ -34,7 +34,7 @@ class ImageViewer(QMainWindow):
self._image_label = QLabel()
self._image_label.setBackgroundRole(QPalette.Base)
self._image_label.setSizePolicy(QSizePolicy.Ignored,
- QSizePolicy.Ignored)
+ QSizePolicy.Ignored)
self._image_label.setScaledContents(True)
self._scroll_area = QScrollArea()
diff --git a/examples/widgets/itemviews/address_book/adddialogwidget.py b/examples/widgets/itemviews/address_book/adddialogwidget.py
index 276a8d2b4..ecb853e80 100644
--- a/examples/widgets/itemviews/address_book/adddialogwidget.py
+++ b/examples/widgets/itemviews/address_book/adddialogwidget.py
@@ -15,8 +15,8 @@ class AddDialogWidget(QDialog):
name_label = QLabel("Name")
address_label = QLabel("Address")
- button_box = QDialogButtonBox(QDialogButtonBox.Ok |
- QDialogButtonBox.Cancel)
+ button_box = QDialogButtonBox(QDialogButtonBox.Ok
+ | QDialogButtonBox.Cancel)
self._name_text = QLineEdit()
self._address_text = QTextEdit()
diff --git a/examples/widgets/itemviews/address_book/address_book.py b/examples/widgets/itemviews/address_book/address_book.py
index 2e1f6b9b0..af0cf3dee 100644
--- a/examples/widgets/itemviews/address_book/address_book.py
+++ b/examples/widgets/itemviews/address_book/address_book.py
@@ -25,16 +25,19 @@ class MainWindow(QMainWindow):
tool_menu = self.menuBar().addMenu("&Tools")
# Populate the File menu
- open_action = self.create_action("&Open...", file_menu, self.open_file)
- save_action = self.create_action("&Save As...", file_menu, self.save_file)
+ self.open_action = self.create_action("&Open...", file_menu, self.open_file)
+ self.save_action = self.create_action("&Save As...", file_menu, self.save_file)
file_menu.addSeparator()
- exit_action = self.create_action("E&xit", file_menu, self.close)
+ self.exit_action = self.create_action("E&xit", file_menu, self.close)
# Populate the Tools menu
- add_action = self.create_action("&Add Entry...", tool_menu, self._address_widget.add_entry)
- self._edit_action = self.create_action("&Edit Entry...", tool_menu, self._address_widget.edit_entry)
+ self.add_action = self.create_action(
+ "&Add Entry...", tool_menu, self._address_widget.add_entry)
+ self._edit_action = self.create_action(
+ "&Edit Entry...", tool_menu, self._address_widget.edit_entry)
tool_menu.addSeparator()
- self._remove_action = self.create_action("&Remove Entry", tool_menu, self._address_widget.remove_entry)
+ self._remove_action = self.create_action(
+ "&Remove Entry", tool_menu, self._address_widget.remove_entry)
# Disable the edit and remove menu items initially, as there are
# no items yet.
diff --git a/examples/widgets/itemviews/address_book/addresswidget.py b/examples/widgets/itemviews/address_book/addresswidget.py
index ab1330e48..cb2f46ea1 100644
--- a/examples/widgets/itemviews/address_book/addresswidget.py
+++ b/examples/widgets/itemviews/address_book/addresswidget.py
@@ -166,8 +166,9 @@ class AddressWidget(QTabWidget):
proxy_model.setFilterKeyColumn(0) # Filter on the "name" column
proxy_model.sort(0, Qt.AscendingOrder)
- # This prevents an application crash (see: https://www.qtcentre.org/threads/58874-QListView-SelectionModel-selectionChanged-Crash)
- viewselectionmodel = table_view.selectionModel()
+ # This prevents an application crash (see:
+ # https://www.qtcentre.org/threads/58874-QListView-SelectionModel-selectionChanged-Crash) # noqa: E501
+ self.viewselectionmodel = table_view.selectionModel()
table_view.selectionModel().selectionChanged.connect(self.selection_changed)
self.addTab(table_view, group)
diff --git a/examples/widgets/itemviews/address_book/tablemodel.py b/examples/widgets/itemviews/address_book/tablemodel.py
index a0d63bbe2..3c1dbd4cc 100644
--- a/examples/widgets/itemviews/address_book/tablemodel.py
+++ b/examples/widgets/itemviews/address_book/tablemodel.py
@@ -105,5 +105,5 @@ class TableModel(QAbstractTableModel):
"""
if not index.isValid():
return Qt.ItemIsEnabled
- return Qt.ItemFlags(QAbstractTableModel.flags(self, index) |
- Qt.ItemIsEditable)
+ return Qt.ItemFlags(QAbstractTableModel.flags(self, index)
+ | Qt.ItemIsEditable)
diff --git a/examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py b/examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py
index 834237404..a30b0abdf 100644
--- a/examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py
+++ b/examples/widgets/itemviews/basicfiltermodel/basicsortfiltermodel.py
@@ -46,11 +46,11 @@ class Window(QWidget):
self._filter_syntax_combo_box = QComboBox()
self._filter_syntax_combo_box.addItem("Regular expression",
- REGULAR_EXPRESSION)
+ REGULAR_EXPRESSION)
self._filter_syntax_combo_box.addItem("Wildcard",
- WILDCARD)
+ WILDCARD)
self._filter_syntax_combo_box.addItem("Fixed string",
- FIXED_STRING)
+ FIXED_STRING)
self._filter_syntax_label = QLabel("Filter &syntax:")
self._filter_syntax_label.setBuddy(self._filter_syntax_combo_box)
@@ -147,25 +147,25 @@ def create_mail_model(parent):
model.setHeaderData(2, Qt.Horizontal, "Date")
add_mail(model, "Happy New Year!", "Grace K. <grace@software-inc.com>",
- QDateTime(QDate(2006, 12, 31), QTime(17, 3)))
+ QDateTime(QDate(2006, 12, 31), QTime(17, 3)))
add_mail(model, "Radically new concept", "Grace K. <grace@software-inc.com>",
- QDateTime(QDate(2006, 12, 22), QTime(9, 44)))
+ QDateTime(QDate(2006, 12, 22), QTime(9, 44)))
add_mail(model, "Accounts", "pascale@nospam.com",
- QDateTime(QDate(2006, 12, 31), QTime(12, 50)))
+ QDateTime(QDate(2006, 12, 31), QTime(12, 50)))
add_mail(model, "Expenses", "Joe Bloggs <joe@bloggs.com>",
- QDateTime(QDate(2006, 12, 25), QTime(11, 39)))
+ QDateTime(QDate(2006, 12, 25), QTime(11, 39)))
add_mail(model, "Re: Expenses", "Andy <andy@nospam.com>",
- QDateTime(QDate(2007, 1, 2), QTime(16, 5)))
+ QDateTime(QDate(2007, 1, 2), QTime(16, 5)))
add_mail(model, "Re: Accounts", "Joe Bloggs <joe@bloggs.com>",
- QDateTime(QDate(2007, 1, 3), QTime(14, 18)))
+ QDateTime(QDate(2007, 1, 3), QTime(14, 18)))
add_mail(model, "Re: Accounts", "Andy <andy@nospam.com>",
- QDateTime(QDate(2007, 1, 3), QTime(14, 26)))
+ QDateTime(QDate(2007, 1, 3), QTime(14, 26)))
add_mail(model, "Sports", "Linda Smith <linda.smith@nospam.com>",
- QDateTime(QDate(2007, 1, 5), QTime(11, 33)))
+ QDateTime(QDate(2007, 1, 5), QTime(11, 33)))
add_mail(model, "AW: Sports", "Rolf Newschweinstein <rolfn@nospam.com>",
- QDateTime(QDate(2007, 1, 5), QTime(12, 0)))
+ QDateTime(QDate(2007, 1, 5), QTime(12, 0)))
add_mail(model, "RE: Sports", "Petra Schmidt <petras@nospam.com>",
- QDateTime(QDate(2007, 1, 5), QTime(12, 1)))
+ QDateTime(QDate(2007, 1, 5), QTime(12, 1)))
return model
diff --git a/examples/widgets/itemviews/dirview/dirview.py b/examples/widgets/itemviews/dirview/dirview.py
index aa1e62185..d1be6958e 100644
--- a/examples/widgets/itemviews/dirview/dirview.py
+++ b/examples/widgets/itemviews/dirview/dirview.py
@@ -57,4 +57,3 @@ if __name__ == "__main__":
tree.show()
sys.exit(app.exec())
-
diff --git a/examples/widgets/itemviews/editabletreemodel/mainwindow.py b/examples/widgets/itemviews/editabletreemodel/mainwindow.py
index c6abfa568..1489bf28b 100644
--- a/examples/widgets/itemviews/editabletreemodel/mainwindow.py
+++ b/examples/widgets/itemviews/editabletreemodel/mainwindow.py
@@ -52,7 +52,7 @@ class MainWindow(QMainWindow):
self.insert_child_action.setShortcut("Ctrl+N")
self.insert_child_action.triggered.connect(self.insert_child)
help_menu = menubar.addMenu("&Help")
- about_qt_action = help_menu.addAction("About Qt", qApp.aboutQt)
+ about_qt_action = help_menu.addAction("About Qt", qApp.aboutQt) # noqa: F821
about_qt_action.setShortcut("F1")
self.setWindowTitle("Editable Tree Model")
diff --git a/examples/widgets/itemviews/fetchmore/fetchmore.py b/examples/widgets/itemviews/fetchmore/fetchmore.py
index ecee86e38..5150250e0 100644
--- a/examples/widgets/itemviews/fetchmore/fetchmore.py
+++ b/examples/widgets/itemviews/fetchmore/fetchmore.py
@@ -49,7 +49,7 @@ class FileListModel(QAbstractListModel):
if role == Qt.BackgroundRole:
batch = row // BATCH_SIZE
- palette = qApp.palette()
+ palette = qApp.palette() # noqa: F821
return palette.base() if batch % 2 == 0 else palette.alternateBase()
if role == Qt.DecorationRole:
@@ -112,7 +112,7 @@ class Window(QWidget):
self.setWindowTitle("Fetch More Example")
- @Slot(str,int,int,int)
+ @Slot(str, int, int, int)
def update_log(self, path, start, number, total):
native_path = QDir.toNativeSeparators(path)
last = start + number - 1
diff --git a/examples/widgets/itemviews/jsonmodel/jsonmodel.py b/examples/widgets/itemviews/jsonmodel/jsonmodel.py
index c0adfc664..6e614c77f 100644
--- a/examples/widgets/itemviews/jsonmodel/jsonmodel.py
+++ b/examples/widgets/itemviews/jsonmodel/jsonmodel.py
@@ -3,7 +3,7 @@
import json
import sys
-from typing import Any, Iterable, List, Dict, Union
+from typing import Any, List, Dict, Union
from PySide6.QtWidgets import QTreeView, QApplication, QHeaderView
from PySide6.QtCore import QAbstractItemModel, QModelIndex, QObject, Qt, QFileInfo
@@ -182,10 +182,7 @@ class JsonModel(QAbstractItemModel):
item = index.internalPointer()
item.value = str(value)
- if __binding__ in ("PySide", "PyQt4"):
- self.dataChanged.emit(index, index)
- else:
- self.dataChanged.emit(index, index, [Qt.EditRole])
+ self.dataChanged.emit(index, index, [Qt.EditRole])
return True
diff --git a/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py b/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py
index 266b8c1e1..577f0faa5 100644
--- a/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py
+++ b/examples/widgets/itemviews/spinboxdelegate/spinboxdelegate.py
@@ -10,6 +10,7 @@ from PySide6.QtCore import QModelIndex
"""PySide6 port of the widgets/itemviews/spinboxdelegate from Qt v6.x"""
+
#! [0]
class SpinBoxDelegate(QStyledItemDelegate):
"""A delegate that allows the user to change integer values from the model
@@ -52,7 +53,7 @@ class SpinBoxDelegate(QStyledItemDelegate):
if __name__ == '__main__':
app = QApplication(sys.argv)
- model= QStandardItemModel(4, 2)
+ model = QStandardItemModel(4, 2)
tableView = QTableView()
tableView.setModel(model)
diff --git a/examples/widgets/itemviews/stardelegate/stardelegate.py b/examples/widgets/itemviews/stardelegate/stardelegate.py
index 87bf1ff48..973eb14f6 100644
--- a/examples/widgets/itemviews/stardelegate/stardelegate.py
+++ b/examples/widgets/itemviews/stardelegate/stardelegate.py
@@ -111,15 +111,15 @@ if __name__ == "__main__":
# Create and populate the tableWidget
table_widget = QTableWidget(4, 4)
table_widget.setItemDelegate(StarDelegate())
- table_widget.setEditTriggers(QAbstractItemView.DoubleClicked |
- QAbstractItemView.SelectedClicked)
+ table_widget.setEditTriggers(QAbstractItemView.DoubleClicked
+ | QAbstractItemView.SelectedClicked)
table_widget.setSelectionBehavior(QAbstractItemView.SelectRows)
table_widget.setHorizontalHeaderLabels(["Title", "Genre", "Artist", "Rating"])
- data = [ ["Mass in B-Minor", "Baroque", "J.S. Bach", 5],
- ["Three More Foxes", "Jazz", "Maynard Ferguson", 4],
- ["Sex Bomb", "Pop", "Tom Jones", 3],
- ["Barbie Girl", "Pop", "Aqua", 5] ]
+ data = [["Mass in B-Minor", "Baroque", "J.S. Bach", 5],
+ ["Three More Foxes", "Jazz", "Maynard Ferguson", 4],
+ ["Sex Bomb", "Pop", "Tom Jones", 3],
+ ["Barbie Girl", "Pop", "Aqua", 5]]
for r in range(len(data)):
table_widget.setItem(r, 0, QTableWidgetItem(data[r][0]))
diff --git a/examples/widgets/itemviews/stardelegate/stareditor.py b/examples/widgets/itemviews/stardelegate/stareditor.py
index 1b44164a8..296afa950 100644
--- a/examples/widgets/itemviews/stardelegate/stareditor.py
+++ b/examples/widgets/itemviews/stardelegate/stareditor.py
@@ -55,8 +55,7 @@ class StarEditor(QWidget):
""" Calculate which star the user's mouse cursor is currently
hovering over.
"""
- star = (x / (self.star_rating.sizeHint().width() /
- self.star_rating.MAX_STAR_COUNT)) + 1
+ star = (x / (self.star_rating.sizeHint().width() / self.star_rating.MAX_STAR_COUNT)) + 1
if (star <= 0) or (star > self.star_rating.MAX_STAR_COUNT):
return -1
diff --git a/examples/widgets/itemviews/stardelegate/starrating.py b/examples/widgets/itemviews/stardelegate/starrating.py
index 4d49f7405..28dbacd6f 100644
--- a/examples/widgets/itemviews/stardelegate/starrating.py
+++ b/examples/widgets/itemviews/stardelegate/starrating.py
@@ -23,13 +23,13 @@ class StarRating(object):
self._star_polygon.append(QPointF(1.0, 0.5))
for i in range(1, 5):
self._star_polygon.append(QPointF(0.5 + 0.5 * cos(0.8 * i * pi),
- 0.5 + 0.5 * sin(0.8 * i * pi)))
+ 0.5 + 0.5 * sin(0.8 * i * pi)))
# Create the diamond shape we'll show in the editor
self._diamond_polygon = QPolygonF()
diamond_points = [QPointF(0.4, 0.5), QPointF(0.5, 0.4),
- QPointF(0.6, 0.5), QPointF(0.5, 0.6),
- QPointF(0.4, 0.5)]
+ QPointF(0.6, 0.5), QPointF(0.5, 0.6),
+ QPointF(0.4, 0.5)]
self._diamond_polygon.append(diamond_points)
def sizeHint(self):
diff --git a/examples/widgets/layouts/basiclayouts/basiclayouts.py b/examples/widgets/layouts/basiclayouts/basiclayouts.py
index a2d29e71f..827cb7850 100644
--- a/examples/widgets/layouts/basiclayouts/basiclayouts.py
+++ b/examples/widgets/layouts/basiclayouts/basiclayouts.py
@@ -27,7 +27,7 @@ class Dialog(QDialog):
big_editor = QTextEdit()
big_editor.setPlainText("This widget takes up all the remaining space "
- "in the top-level layout.")
+ "in the top-level layout.")
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
@@ -75,8 +75,7 @@ class Dialog(QDialog):
layout.addWidget(line_edit, i + 1, 1)
self._small_editor = QTextEdit()
- self._small_editor.setPlainText("This widget takes up about two thirds "
- "of the grid layout.")
+ self._small_editor.setPlainText("This widget takes up about two thirds of the grid layout.")
layout.addWidget(self._small_editor, 0, 2, 4, 1)
diff --git a/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py b/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py
index 4e3791519..c9dfcc730 100644
--- a/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py
+++ b/examples/widgets/layouts/dynamiclayouts/dynamiclayouts.py
@@ -74,8 +74,8 @@ class Dialog(QDialog):
def show_help(self):
QMessageBox.information(self, "Dynamic Layouts Help",
- "This example shows how to change layouts "
- "dynamically.")
+ "This example shows how to change layouts "
+ "dynamically.")
def create_rotable_group_box(self):
self._rotable_group_box = QGroupBox("Rotable Widgets")
@@ -102,7 +102,8 @@ class Dialog(QDialog):
buttons_orientation_combo_box = QComboBox()
buttons_orientation_combo_box.addItem("Horizontal", Qt.Horizontal)
buttons_orientation_combo_box.addItem("Vertical", Qt.Vertical)
- buttons_orientation_combo_box.currentIndexChanged[int].connect(self.buttons_orientation_changed)
+ buttons_orientation_combo_box.currentIndexChanged[int].connect(
+ self.buttons_orientation_changed)
self._buttons_orientation_combo_box = buttons_orientation_combo_box
@@ -117,7 +118,8 @@ class Dialog(QDialog):
close_button = self._button_box.addButton(QDialogButtonBox.Close)
help_button = self._button_box.addButton(QDialogButtonBox.Help)
- rotate_widgets_button = self._button_box.addButton("Rotate &Widgets", QDialogButtonBox.ActionRole)
+ rotate_widgets_button = self._button_box.addButton(
+ "Rotate &Widgets", QDialogButtonBox.ActionRole)
rotate_widgets_button.clicked.connect(self.rotate_widgets)
close_button.clicked.connect(self.close)
diff --git a/examples/widgets/linguist/doc/linguist.rst b/examples/widgets/linguist/doc/linguist.rst
new file mode 100644
index 000000000..24a49a617
--- /dev/null
+++ b/examples/widgets/linguist/doc/linguist.rst
@@ -0,0 +1,7 @@
+.. _qt-linguist-example:
+
+Qt Linguist Example
+===================
+
+This example demonstrates the use of Qt Linguist and related tools for translating
+applications as described in :ref:`translations`.
diff --git a/examples/widgets/linguist/linguist.qrc b/examples/widgets/linguist/linguist.qrc
index 2b08ae577..6ca287c20 100644
--- a/examples/widgets/linguist/linguist.qrc
+++ b/examples/widgets/linguist/linguist.qrc
@@ -1,5 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>translations/example_de.qm</file>
+<qresource prefix="translations">
+ <file>example_de.qm</file>
</qresource>
</RCC>
diff --git a/examples/widgets/linguist/main.py b/examples/widgets/linguist/main.py
index 16655432c..e4212e801 100644
--- a/examples/widgets/linguist/main.py
+++ b/examples/widgets/linguist/main.py
@@ -9,7 +9,7 @@ from PySide6.QtWidgets import (QAbstractItemView, QApplication, QListWidget,
QMainWindow)
-import linguist_rc
+import linguist_rc # noqa: F401
class Window(QMainWindow):
@@ -21,7 +21,7 @@ class Window(QMainWindow):
quit_action.triggered.connect(self.close)
help_menu = self.menuBar().addMenu(self.tr("&Help"))
about_qt_action = help_menu.addAction(self.tr("About Qt"))
- about_qt_action.triggered.connect(qApp.aboutQt)
+ about_qt_action.triggered.connect(qApp.aboutQt) # noqa: F821
self._list_widget = QListWidget()
self._list_widget.setSelectionMode(QAbstractItemView.MultiSelection)
diff --git a/examples/widgets/mainwindows/application/application.py b/examples/widgets/mainwindows/application/application.py
index 320c421a6..f69eade2e 100644
--- a/examples/widgets/mainwindows/application/application.py
+++ b/examples/widgets/mainwindows/application/application.py
@@ -11,7 +11,7 @@ from PySide6.QtGui import QAction, QIcon, QKeySequence
from PySide6.QtWidgets import (QApplication, QFileDialog, QMainWindow,
QMessageBox, QTextEdit)
-import application_rc
+import application_rc # noqa: F401
class MainWindow(QMainWindow):
@@ -73,61 +73,64 @@ class MainWindow(QMainWindow):
@Slot()
def about(self):
QMessageBox.about(self, "About Application",
- "The <b>Application</b> example demonstrates how to write "
- "modern GUI applications using Qt, with a menu bar, "
- "toolbars, and a status bar.")
+ "The <b>Application</b> example demonstrates how to write "
+ "modern GUI applications using Qt, with a menu bar, "
+ "toolbars, and a status bar.")
@Slot()
def document_was_modified(self):
self.setWindowModified(self._text_edit.document().isModified())
def create_actions(self):
- icon = QIcon.fromTheme("document-new", QIcon(':/images/new.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentNew, QIcon(':/images/new.png'))
self._new_act = QAction(icon, "&New", self, shortcut=QKeySequence.New,
- statusTip="Create a new file", triggered=self.new_file)
+ statusTip="Create a new file", triggered=self.new_file)
- icon = QIcon.fromTheme("document-open", QIcon(':/images/open.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentOpen, QIcon(':/images/open.png'))
self._open_act = QAction(icon, "&Open...", self,
- shortcut=QKeySequence.Open, statusTip="Open an existing file",
- triggered=self.open)
+ shortcut=QKeySequence.Open, statusTip="Open an existing file",
+ triggered=self.open)
- icon = QIcon.fromTheme("document-save", QIcon(':/images/save.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentSave, QIcon(':/images/save.png'))
self._save_act = QAction(icon, "&Save", self,
- shortcut=QKeySequence.Save,
- statusTip="Save the document to disk", triggered=self.save)
+ shortcut=QKeySequence.Save,
+ statusTip="Save the document to disk", triggered=self.save)
self._save_as_act = QAction("Save &As...", self,
- shortcut=QKeySequence.SaveAs,
- statusTip="Save the document under a new name",
- triggered=self.save_as)
+ shortcut=QKeySequence.SaveAs,
+ statusTip="Save the document under a new name",
+ triggered=self.save_as)
- self._exit_act = QAction("E&xit", self, shortcut="Ctrl+Q",
- statusTip="Exit the application", triggered=self.close)
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.ApplicationExit)
+ self._exit_act = QAction(icon, "E&xit", self, shortcut="Ctrl+Q",
+ statusTip="Exit the application", triggered=self.close)
- icon = QIcon.fromTheme("edit-cut", QIcon(':/images/cut.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditCut, QIcon(':/images/cut.png'))
self._cut_act = QAction(icon, "Cu&t", self, shortcut=QKeySequence.Cut,
- statusTip="Cut the current selection's contents to the clipboard",
- triggered=self._text_edit.cut)
+ statusTip="Cut the current selection's contents to the clipboard",
+ triggered=self._text_edit.cut)
- icon = QIcon.fromTheme("edit-copy", QIcon(':/images/copy.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditCopy, QIcon(':/images/copy.png'))
self._copy_act = QAction(icon, "&Copy",
- self, shortcut=QKeySequence.Copy,
- statusTip="Copy the current selection's contents to the clipboard",
- triggered=self._text_edit.copy)
+ self, shortcut=QKeySequence.Copy,
+ statusTip="Copy the current selection's contents to the clipboard",
+ triggered=self._text_edit.copy)
- icon = QIcon.fromTheme("edit-paste", QIcon(':/images/paste.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditPaste, QIcon(':/images/paste.png'))
self._paste_act = QAction(icon, "&Paste",
- self, shortcut=QKeySequence.Paste,
- statusTip="Paste the clipboard's contents into the current selection",
- triggered=self._text_edit.paste)
+ self, shortcut=QKeySequence.Paste,
+ statusTip="Paste the clipboard's contents into the current "
+ "selection",
+ triggered=self._text_edit.paste)
- self._about_act = QAction("&About", self,
- statusTip="Show the application's About box",
- triggered=self.about)
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.HelpAbout)
+ self._about_act = QAction(icon, "&About", self,
+ statusTip="Show the application's About box",
+ triggered=self.about)
self._about_qt_act = QAction("About &Qt", self,
- statusTip="Show the Qt library's About box",
- triggered=qApp.aboutQt)
+ statusTip="Show the Qt library's About box",
+ triggered=qApp.aboutQt) # noqa: F821
self._cut_act.setEnabled(False)
self._copy_act.setEnabled(False)
@@ -181,10 +184,9 @@ class MainWindow(QMainWindow):
def maybe_save(self):
if self._text_edit.document().isModified():
ret = QMessageBox.warning(self, "Application",
- "The document has been modified.\nDo you want to save "
- "your changes?",
- QMessageBox.Save | QMessageBox.Discard |
- QMessageBox.Cancel)
+ "The document has been modified.\nDo you want to save "
+ "your changes?",
+ QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
if ret == QMessageBox.Save:
return self.save()
elif ret == QMessageBox.Cancel:
@@ -195,8 +197,7 @@ class MainWindow(QMainWindow):
file = QFile(fileName)
if not file.open(QFile.ReadOnly | QFile.Text):
reason = file.errorString()
- QMessageBox.warning(self, "Application",
- f"Cannot read file {fileName}:\n{reason}.")
+ QMessageBox.warning(self, "Application", f"Cannot read file {fileName}:\n{reason}.")
return
inf = QTextStream(file)
diff --git a/examples/widgets/mainwindows/application/application.pyproject b/examples/widgets/mainwindows/application/application.pyproject
index 0e0413982..a9365ed1a 100644
--- a/examples/widgets/mainwindows/application/application.pyproject
+++ b/examples/widgets/mainwindows/application/application.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["application.qrc", "application.py", "application_rc.py"]
+ "files": ["application.qrc", "application.py"]
}
diff --git a/examples/widgets/mainwindows/dockwidgets/dockwidgets.py b/examples/widgets/mainwindows/dockwidgets/dockwidgets.py
index 6d0e95a81..83487ee58 100644
--- a/examples/widgets/mainwindows/dockwidgets/dockwidgets.py
+++ b/examples/widgets/mainwindows/dockwidgets/dockwidgets.py
@@ -2,18 +2,20 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-"""PySide6 port of the widgets/mainwindows/dockwidgets example from Qt v5.x, originating from PyQt"""
+"""PySide6 port of the widgets/mainwindows/dockwidgets example from Qt v5.x,
+ originating from PyQt"""
import sys
from PySide6.QtCore import QDate, QFile, Qt, QTextStream
from PySide6.QtGui import (QAction, QFont, QIcon, QKeySequence,
- QTextCharFormat, QTextCursor, QTextTableFormat)
+ QTextCharFormat, QTextCursor, QTextTableFormat)
from PySide6.QtPrintSupport import QPrintDialog, QPrinter
from PySide6.QtWidgets import (QApplication, QDialog, QDockWidget,
- QFileDialog, QListWidget, QMainWindow, QMessageBox, QTextEdit)
+ QFileDialog, QListWidget, QMainWindow,
+ QMessageBox, QTextEdit)
-import dockwidgets_rc
+import dockwidgets_rc # noqa: F401
class MainWindow(QMainWindow):
@@ -62,8 +64,7 @@ class MainWindow(QMainWindow):
cursor.insertBlock()
cursor.insertText("Some Country")
cursor.setPosition(top_frame.lastPosition())
- cursor.insertText(QDate.currentDate().toString("d MMMM yyyy"),
- text_format)
+ cursor.insertText(QDate.currentDate().toString("d MMMM yyyy"), text_format)
cursor.insertBlock()
cursor.insertBlock()
cursor.insertText("Dear ", text_format)
@@ -103,7 +104,7 @@ class MainWindow(QMainWindow):
if not file.open(QFile.WriteOnly | QFile.Text):
reason = file.errorString()
QMessageBox.warning(self, "Dock Widgets",
- f"Cannot write file {filename}:\n{reason}.")
+ f"Cannot write file {filename}:\n{reason}.")
return
out = QTextStream(file)
@@ -143,8 +144,8 @@ class MainWindow(QMainWindow):
if cursor.isNull():
return
cursor.beginEditBlock()
- cursor.movePosition(QTextCursor.PreviousBlock, QTextCursor.MoveAnchor,
- 2)
+ cursor.movePosition(QTextCursor.PreviousBlock,
+ QTextCursor.MoveAnchor, 2)
cursor.insertBlock()
cursor.insertText(paragraph)
cursor.insertBlock()
@@ -152,43 +153,44 @@ class MainWindow(QMainWindow):
def about(self):
QMessageBox.about(self, "About Dock Widgets",
- "The <b>Dock Widgets</b> example demonstrates how to use "
- "Qt's dock widgets. You can enter your own text, click a "
- "customer to add a customer name and address, and click "
- "standard paragraphs to add them.")
+ "The <b>Dock Widgets</b> example demonstrates how to use "
+ "Qt's dock widgets. You can enter your own text, click a "
+ "customer to add a customer name and address, and click "
+ "standard paragraphs to add them.")
def create_actions(self):
icon = QIcon.fromTheme('document-new', QIcon(':/images/new.png'))
self._new_letter_act = QAction(icon, "&New Letter",
- self, shortcut=QKeySequence.New,
- statusTip="Create a new form letter", triggered=self.new_letter)
+ self, shortcut=QKeySequence.New,
+ statusTip="Create a new form letter",
+ triggered=self.new_letter)
icon = QIcon.fromTheme('document-save', QIcon(':/images/save.png'))
self._save_act = QAction(icon, "&Save...", self,
- shortcut=QKeySequence.Save,
- statusTip="Save the current form letter", triggered=self.save)
+ shortcut=QKeySequence.Save,
+ statusTip="Save the current form letter", triggered=self.save)
icon = QIcon.fromTheme('document-print', QIcon(':/images/print.png'))
self._print_act = QAction(icon, "&Print...", self,
- shortcut=QKeySequence.Print,
- statusTip="Print the current form letter",
- triggered=self.print_)
+ shortcut=QKeySequence.Print,
+ statusTip="Print the current form letter",
+ triggered=self.print_)
icon = QIcon.fromTheme('edit-undo', QIcon(':/images/undo.png'))
self._undo_act = QAction(icon, "&Undo", self,
- shortcut=QKeySequence.Undo,
- statusTip="Undo the last editing action", triggered=self.undo)
+ shortcut=QKeySequence.Undo,
+ statusTip="Undo the last editing action", triggered=self.undo)
self._quit_act = QAction("&Quit", self, shortcut="Ctrl+Q",
- statusTip="Quit the application", triggered=self.close)
+ statusTip="Quit the application", triggered=self.close)
self._about_act = QAction("&About", self,
- statusTip="Show the application's About box",
- triggered=self.about)
+ statusTip="Show the application's About box",
+ triggered=self.about)
self._about_qt_act = QAction("About &Qt", self,
- statusTip="Show the Qt library's About box",
- triggered=QApplication.instance().aboutQt)
+ statusTip="Show the Qt library's About box",
+ triggered=QApplication.instance().aboutQt)
def create_menus(self):
self._file_menu = self.menuBar().addMenu("&File")
@@ -241,21 +243,21 @@ class MainWindow(QMainWindow):
self._paragraphs_list.addItems((
"Thank you for your payment which we have received today.",
"Your order has been dispatched and should be with you within "
- "28 days.",
+ "28 days.",
"We have dispatched those items that were in stock. The rest of "
- "your order will be dispatched once all the remaining items "
- "have arrived at our warehouse. No additional shipping "
- "charges will be made.",
+ "your order will be dispatched once all the remaining items "
+ "have arrived at our warehouse. No additional shipping "
+ "charges will be made.",
"You made a small overpayment (less than $5) which we will keep "
- "on account for you, or return at your request.",
+ "on account for you, or return at your request.",
"You made a small underpayment (less than $1), but we have sent "
- "your order anyway. We'll add this underpayment to your next "
- "bill.",
+ "your order anyway. We'll add this underpayment to your next "
+ "bill.",
"Unfortunately you did not send enough money. Please remit an "
- "additional $. Your order will be dispatched as soon as the "
- "complete amount has been received.",
+ "additional $. Your order will be dispatched as soon as the "
+ "complete amount has been received.",
"You made an overpayment (more than $5). Do you wish to buy more "
- "items, or should we return the excess to you?"))
+ "items, or should we return the excess to you?"))
dock.setWidget(self._paragraphs_list)
self.addDockWidget(Qt.RightDockWidgetArea, dock)
self._view_menu.addAction(dock.toggleViewAction())
diff --git a/examples/widgets/mainwindows/dockwidgets/dockwidgets.pyproject b/examples/widgets/mainwindows/dockwidgets/dockwidgets.pyproject
index 2df11468e..9abbf7485 100644
--- a/examples/widgets/mainwindows/dockwidgets/dockwidgets.pyproject
+++ b/examples/widgets/mainwindows/dockwidgets/dockwidgets.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["dockwidgets.qrc", "dockwidgets.py", "dockwidgets_rc.py"]
+ "files": ["dockwidgets.qrc", "dockwidgets.py"]
}
diff --git a/examples/widgets/mainwindows/mdi/images/copy.png b/examples/widgets/mainwindows/mdi/images/copy.png
deleted file mode 100644
index 2aeb28288..000000000
--- a/examples/widgets/mainwindows/mdi/images/copy.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/mainwindows/mdi/images/cut.png b/examples/widgets/mainwindows/mdi/images/cut.png
deleted file mode 100644
index 54638e938..000000000
--- a/examples/widgets/mainwindows/mdi/images/cut.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/mainwindows/mdi/images/new.png b/examples/widgets/mainwindows/mdi/images/new.png
deleted file mode 100644
index 12131b010..000000000
--- a/examples/widgets/mainwindows/mdi/images/new.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/mainwindows/mdi/images/open.png b/examples/widgets/mainwindows/mdi/images/open.png
deleted file mode 100644
index 45fa2883a..000000000
--- a/examples/widgets/mainwindows/mdi/images/open.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/mainwindows/mdi/images/paste.png b/examples/widgets/mainwindows/mdi/images/paste.png
deleted file mode 100644
index c14425cad..000000000
--- a/examples/widgets/mainwindows/mdi/images/paste.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/mainwindows/mdi/images/save.png b/examples/widgets/mainwindows/mdi/images/save.png
deleted file mode 100644
index daba865fa..000000000
--- a/examples/widgets/mainwindows/mdi/images/save.png
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/mainwindows/mdi/mdi.py b/examples/widgets/mainwindows/mdi/mdi.py
index 597479981..c1fa01b8c 100644
--- a/examples/widgets/mainwindows/mdi/mdi.py
+++ b/examples/widgets/mainwindows/mdi/mdi.py
@@ -9,12 +9,12 @@ from functools import partial
import sys
from PySide6.QtCore import (QByteArray, QFile, QFileInfo, QSettings,
- QSaveFile, QTextStream, Qt, Slot)
+ QSaveFile, QTextStream, Qt, Slot)
from PySide6.QtGui import QAction, QIcon, QKeySequence
from PySide6.QtWidgets import (QApplication, QFileDialog, QMainWindow,
- QMdiArea, QMessageBox, QTextEdit)
+ QMdiArea, QMessageBox, QTextEdit)
-import mdi_rc
+import PySide6.QtExampleIcons # noqa: F401
class MdiChild(QTextEdit):
@@ -106,7 +106,7 @@ class MdiChild(QTextEdit):
f = self.user_friendly_current_file()
message = f"'{f}' has been modified.\nDo you want to save your changes?"
ret = QMessageBox.warning(self, "MDI", message,
- QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
+ QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
if ret == QMessageBox.Save:
return self.save()
@@ -208,8 +208,8 @@ class MainWindow(QMainWindow):
@Slot()
def about(self):
QMessageBox.about(self, "About MDI",
- "The <b>MDI</b> example demonstrates how to write multiple "
- "document interface applications using Qt.")
+ "The <b>MDI</b> example demonstrates how to write multiple "
+ "document interface applications using Qt.")
@Slot()
def update_menus(self):
@@ -225,8 +225,8 @@ class MainWindow(QMainWindow):
self._previous_act.setEnabled(has_mdi_child)
self._separator_act.setVisible(has_mdi_child)
- has_selection = (self.active_mdi_child() is not None and
- self.active_mdi_child().textCursor().hasSelection())
+ has_selection = (self.active_mdi_child() is not None
+ and self.active_mdi_child().textCursor().hasSelection())
self._cut_act.setEnabled(has_selection)
self._copy_act.setEnabled(has_selection)
@@ -271,82 +271,85 @@ class MainWindow(QMainWindow):
def create_actions(self):
- icon = QIcon.fromTheme("document-new", QIcon(':/images/new.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentNew)
self._new_act = QAction(icon, "&New", self,
- shortcut=QKeySequence.New, statusTip="Create a new file",
- triggered=self.new_file)
+ shortcut=QKeySequence.New, statusTip="Create a new file",
+ triggered=self.new_file)
- icon = QIcon.fromTheme("document-open", QIcon(':/images/open.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentOpen)
self._open_act = QAction(icon, "&Open...", self,
- shortcut=QKeySequence.Open, statusTip="Open an existing file",
- triggered=self.open)
+ shortcut=QKeySequence.Open, statusTip="Open an existing file",
+ triggered=self.open)
- icon = QIcon.fromTheme("document-save", QIcon(':/images/save.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentSave)
self._save_act = QAction(icon, "&Save", self,
- shortcut=QKeySequence.Save,
- statusTip="Save the document to disk", triggered=self.save)
+ shortcut=QKeySequence.Save,
+ statusTip="Save the document to disk", triggered=self.save)
self._save_as_act = QAction("Save &As...", self,
- shortcut=QKeySequence.SaveAs,
- statusTip="Save the document under a new name",
- triggered=self.save_as)
+ shortcut=QKeySequence.SaveAs,
+ statusTip="Save the document under a new name",
+ triggered=self.save_as)
- self._exit_act = QAction("E&xit", self, shortcut=QKeySequence.Quit,
- statusTip="Exit the application",
- triggered=QApplication.instance().closeAllWindows)
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.ApplicationExit)
+ self._exit_act = QAction(icon, "E&xit", self, shortcut=QKeySequence.Quit,
+ statusTip="Exit the application",
+ triggered=QApplication.instance().closeAllWindows)
- icon = QIcon.fromTheme("edit-cut", QIcon(':/images/cut.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditCut)
self._cut_act = QAction(icon, "Cu&t", self,
- shortcut=QKeySequence.Cut,
- statusTip="Cut the current selection's contents to the clipboard",
- triggered=self.cut)
+ shortcut=QKeySequence.Cut,
+ statusTip="Cut the current selection's contents to the clipboard",
+ triggered=self.cut)
- icon = QIcon.fromTheme("edit-copy", QIcon(':/images/copy.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditCopy)
self._copy_act = QAction(icon, "&Copy", self,
- shortcut=QKeySequence.Copy,
- statusTip="Copy the current selection's contents to the clipboard",
- triggered=self.copy)
+ shortcut=QKeySequence.Copy,
+ statusTip="Copy the current selection's contents to the clipboard",
+ triggered=self.copy)
- icon = QIcon.fromTheme("edit-paste", QIcon(':/images/paste.png'))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditPaste)
self._paste_act = QAction(icon, "&Paste", self,
- shortcut=QKeySequence.Paste,
- statusTip="Paste the clipboard's contents into the current selection",
- triggered=self.paste)
+ shortcut=QKeySequence.Paste,
+ statusTip="Paste the clipboard's contents into the current "
+ "selection",
+ triggered=self.paste)
self._close_act = QAction("Cl&ose", self,
- statusTip="Close the active window",
- triggered=self._mdi_area.closeActiveSubWindow)
+ statusTip="Close the active window",
+ triggered=self._mdi_area.closeActiveSubWindow)
self._close_all_act = QAction("Close &All", self,
- statusTip="Close all the windows",
- triggered=self._mdi_area.closeAllSubWindows)
+ statusTip="Close all the windows",
+ triggered=self._mdi_area.closeAllSubWindows)
self._tile_act = QAction("&Tile", self, statusTip="Tile the windows",
- triggered=self._mdi_area.tileSubWindows)
+ triggered=self._mdi_area.tileSubWindows)
self._cascade_act = QAction("&Cascade", self,
- statusTip="Cascade the windows",
- triggered=self._mdi_area.cascadeSubWindows)
+ statusTip="Cascade the windows",
+ triggered=self._mdi_area.cascadeSubWindows)
self._next_act = QAction("Ne&xt", self, shortcut=QKeySequence.NextChild,
- statusTip="Move the focus to the next window",
- triggered=self._mdi_area.activateNextSubWindow)
+ statusTip="Move the focus to the next window",
+ triggered=self._mdi_area.activateNextSubWindow)
self._previous_act = QAction("Pre&vious", self,
- shortcut=QKeySequence.PreviousChild,
- statusTip="Move the focus to the previous window",
- triggered=self._mdi_area.activatePreviousSubWindow)
+ shortcut=QKeySequence.PreviousChild,
+ statusTip="Move the focus to the previous window",
+ triggered=self._mdi_area.activatePreviousSubWindow)
self._separator_act = QAction(self)
self._separator_act.setSeparator(True)
- self._about_act = QAction("&About", self,
- statusTip="Show the application's About box",
- triggered=self.about)
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.HelpAbout)
+ self._about_act = QAction(icon, "&About", self,
+ statusTip="Show the application's About box",
+ triggered=self.about)
self._about_qt_act = QAction("About &Qt", self,
- statusTip="Show the Qt library's About box",
- triggered=QApplication.instance().aboutQt)
+ statusTip="Show the Qt library's About box",
+ triggered=QApplication.instance().aboutQt)
def create_menus(self):
self._file_menu = self.menuBar().addMenu("&File")
@@ -432,6 +435,11 @@ if __name__ == '__main__':
options = argument_parser.parse_args()
app = QApplication(sys.argv)
+
+ icon_paths = QIcon.themeSearchPaths()
+ QIcon.setThemeSearchPaths(icon_paths + [":/qt-project.org/icons"])
+ QIcon.setFallbackThemeName("example_icons")
+
main_win = MainWindow()
for f in options.files:
main_win.load(f)
diff --git a/examples/widgets/mainwindows/mdi/mdi.pyproject b/examples/widgets/mainwindows/mdi/mdi.pyproject
index 7df26fd77..0272873a7 100644
--- a/examples/widgets/mainwindows/mdi/mdi.pyproject
+++ b/examples/widgets/mainwindows/mdi/mdi.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["mdi_rc.py", "mdi.py", "mdi.qrc"]
+ "files": ["mdi.py"]
}
diff --git a/examples/widgets/mainwindows/mdi/mdi.qrc b/examples/widgets/mainwindows/mdi/mdi.qrc
deleted file mode 100644
index 0a776fab4..000000000
--- a/examples/widgets/mainwindows/mdi/mdi.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>images/copy.png</file>
- <file>images/cut.png</file>
- <file>images/new.png</file>
- <file>images/open.png</file>
- <file>images/paste.png</file>
- <file>images/save.png</file>
-</qresource>
-</RCC>
diff --git a/examples/widgets/mainwindows/mdi/mdi_rc.py b/examples/widgets/mainwindows/mdi/mdi_rc.py
deleted file mode 100644
index bc8336765..000000000
--- a/examples/widgets/mainwindows/mdi/mdi_rc.py
+++ /dev/null
@@ -1,608 +0,0 @@
-# Resource object code (Python 3)
-# Created by: object code
-# Created by: The Resource Compiler for Qt version 6.2.2
-# WARNING! All changes made in this file will be lost!
-
-from PySide6 import QtCore
-
-qt_resource_data = b"\
-\x00\x00\x08\x19\
-\x89\
-PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
-\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
-\x00\x00\x00\x04gAMA\x00\x00\xd6\xd8\xd4OX2\
-\x00\x00\x00\x19tEXtSoftware\
-\x00Adobe ImageRead\
-yq\xc9e<\x00\x00\x07\xabIDATX\xc3\xad\
-W[P\x93g\x1a\xf6\xca\xce\xec\xcc\xf6b/\xbc\xd9\
-\xe9\xce\xecn\xbd\xda\xd9\x9b\xb5\xce\xba;{\xb0\xad\xcc\
-z\xb1\xce\xce:\xb3vTpu\xdb\xe2\x81\xd6\xb6T\
-\x04\xbb\xa5 m\xc1\x82\x06\x08\x07QB\x80\x80\x80\x02\
-!\x81\x10\x92@H\x10s$!gr\x80\x04B \
-\x9c\x09G\xb5Tx\xf6\xfb~\x13\x160X\x8b}g\
-\x9e\xf9/\x92\xfc\xcf\xfb>\xcf\xfb\xbe\xdf\x97]\x00v\
-\xfd\x98 \xf1\x0b\x82\x14\x02\x03\xc1u\x82\x03\xcf\xfd\xfe\
-\x8fH\xbc\x9b \xe1W\xaf\xef\xb5*\x8c\xd6e\xdb\x02\
-`\x19\x1e[\x09'\xf13\xfa\x19\x81\x22\xfc\xdc>v\
-H~\x8a\xa0\xb9\xb6Y\x1c2\xcf\xadB9\xfe\x1dD\
-\xf6Q\xd8\xc7\xe6\xe8\x87\x86={\xf6XSR\xae,\
-\xca::\x10N\xe2\xe5I\xc3\xc41\x04\xb7>I\xf9\
-,`\x9b]YSM\x03M\xb6\x114\xeb\xfb 1\
-y`\x19\x9d\xc5\xbb\xef\xbe?\xc5\xab\xbe\x83\xf1\x89)\
-LO\xcf\xae\x92\xef\xd7\xbct\x02\x11\x9f\x0f\xbe\x1d\xe3\
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\x00\x19tEXtSoftware\
-\x00Adobe ImageRead\
-yq\xc9e<\x00\x00\x02\xe6IDATX\xc3\xd5\
-\x97\xcdN\x13a\x14\x86\xeb5\x94\x95{q\xe1\xd2\xc4\
-\xe0\x05\xb8\xe2\x0e\x5c\xb8\xf4\x02\x5c\xb10\xea\x05\x18\x96\
-&bX\xb8\xb0\x91X \xd1\x9d\xbf\x89\xa4\x14\xb1R\
-\xa4HE\x94\xfe\xd0\x02C\xff\xa6\x9d\x19\xa6e\x80\xe3\
-y{\xfa\x85QJ\x82\xc9!\x86I\xde\x9c3\xa7\xf3\
-\xcd\xfb\x9c\xf3M\x9bN\x84\x88\x22\xffS\x91s\x01\xc0\
-\xc7\xd5\x90n\xff\xa5\xfb\xac\xc7==d\x0d\xa9\x02\xf0\
-12<<\xbcj4::\xba\x19V<\x1e\xaf&\
-\x93\xc9V:\x9dv\x13\x89Dk`` \xcdkn\
-h\x02\xa48\xd2\xe1\xe1q\x99\xba\xef\xb7\xc9\xb2,\xda\
-\xdf\xdf'\x86\xf1x\xcd\x18\xeb\x8a\x1a@?\xf3\xb0\x1c\
-\xc7\xa5Lf\xb9\x0b\x14\x04\x01\xc5b\xb1:\xaf{p\
-\x1a\x88S\x01\x1c\x1c\x10ww\xb2l\xdb\xa1\xf9\xf9\xcf\
-d\x0e\xd7u\xe9\xf9\xc4D\x17B\x05\x00&{\xc1\xc9\
-\xaa7\x1cJ\xce\xcdS\xf8p]\x0f\x8b\x17T\x00\x82\
-\x10@gO\x14\xce\xed\xa6G\x1fgf\xe9\xf5\x9b\xb7\
-\x14\x9f\x9c\xa4\xa9\xa9iz\xf7\xfe\x03E\xa3\xd1e^\
-\x7fA\x05\xc0\xef\x10\xed\xb6%\x86\x85\x9a\xe3\x05\x94]\
-\xcd\xd1\xe4\xf4+z2\xfe\x94\x9e\xc5^\xd0Lb\x0e\
-\x8b\x17U\x00\xda\x81\x18\xf5\x13 <\xff\x90j\xcd6\
-\x157\xab\x94/nS\x89c\x8d\xb7\x85\xd7~Q\x01\
-\xf0y\xcc\xcd]\x1e\xb5\xc7{\xdb\xee\x9f;\xbe\xe4\x88\
-]\xb8\xbd\xee\xe2\x94\xca3\xe0u\xe4\xc6uWb\xd8\
-\x109\xea\xe63D\xd4\x01\xa7\x06\xe0\xf4:\xad9\x22\
-\x98\x98hr\x80\x98kPS\x9d\x00\x00*-\xb91\
-\xe2NS\x8c\x10\x0d\x04\xf2m\xfb(\xb6|E\x00\x9b\
-;\xdbj\xfci\x8e<l\x88\x1a\xae9\x13\x80:\x8f\
-\xb7T#*\xd7\xc5\x04\x06\x06\x005(\x9c\x17\xab\xbc\
-%\xbb\xca\x13\xc0Ma\x0e\x15*rn\xcc~Z\x02\
-hj\xdd\xad\xf1\x94'\x00S\xdc\x1cqm[@`\
-\x9a\xab\x1cu\x9e\xeb\x81A\x15G\x11\xc0j\x891\x0c\
-\xd6w\x04 \x0cd&b\xb6iu\x8b\xa8\xaa\x09P\
-\xb6\xc5\xbc\xd0\x03\xf8\xbe)c\x87)`\x0c\x18\x84\x1c\
-\x00[ME\x00t\x03S\x98\xad\x94\xc5\x1c\xe7F\xe6\
-\x1c\x00\xc8q]\xa9\xa1\x08\x80\xfd\xfcV\x12s3\x01\
-\x085\x18B\xe8\xda|\x8e)\xa8N\x00[\x00\x03\xc8\
-\x98g6\x04\x002\xe6\x85\xde\xf8\x17\x0b\xfc,\xd8\x8a\
-\x00\x18g:O\xb4T\x14#\x98\x02\x00\x02\x0c>\xfb\
-\xc5S(\xf0C\xb8fI\xf7k\xf9R\x87\xd7\xbeT\
-\x01\xc8U\x8f\xbaN\xadK\x0e\x90\xaf\x85\xde\xb7\xc2\x92\
-=O\xa6\xb3\xde\xa3\xb1q\xeb\xda\xd0\xf5\x15\x98\xb3n\
-\xa9\x00l4\xa4k\x18\xff\xe0\x11\x7fZ\x17S\xd4\x13\
-\x0bYo\xe4\xee\xbd\xe2\xa5\xc1\xcbK|m\x8cu\x87\
-5\xa8\xfa\xb7\x1c\xdde\xd9<\x8f\x1f\x19\xfe\x9e\xcf\x1e\
-7\xbd\xc9\xbax&oF\x00h\xf2\xff\x81\x99\x94\x9e\
-\xe9?\xbf\x19\x01B\xd3\xf4\xfc\xbd\x9c\x9e\xa5~\x03Q\
-l%\xa1\x92\x95\x0aw\x00\x00\x00\x00IEND\xae\
-B`\x82\
-\x00\x00\x05:\
-\x89\
-PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
-\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
-\x00\x00\x00\x04gAMA\x00\x00\xd6\xd8\xd4OX2\
-\x00\x00\x00\x19tEXtSoftware\
-\x00Adobe ImageRead\
-yq\xc9e<\x00\x00\x04\xccIDATX\xc3\xb5\
-\x97]L[e\x1c\xc6wo\xbc\xd9\xe5\x12I q\
-\xd7&\xe3N\x13\xb8p\xd1\x85D\xbdP\xe3\x10\x18\xe5\
-+.&J\x04'\x86\xaa\x8b\x99\xe0\xd0\xa2l\x19\x86\
-9\x17\xdc\x1a\x16\x98\x80@l\xa6C\xca +\x83\x1e\
-(\xcc\xda\xd1\x96\xd2\xd2J{\xfa\x01\xa5\xd0\xef\x16\x1e\
-\xdf\xff\xdb\x1d\xc7\xcc\x04*\x87\x93<9o!\x9c\xe7\
-\xf7<\xefG\x0f\x87\x00\x1c\xcaF\xcf\xbd\xfa\xe9\xbbL\
-Z&a\x0fj`\xca\xd9\xe9y\xd9\x9a?]P\xf2\
-\xa5\xc1\xe9\x8f\xa7W\xc3@0\x02\x84\xa2\x19\xad\xc72\
-\x8a'\x81X\x22s\xbfyk\xdaK\x10r\x02\x1c{\
-\xe7\xac\xda\x1c\xd8\xc8\x98\x12@\x84\x99\x85\xe3\x19\x911\
-)\x1aKa%\x94D8\x9aBs\x87\xc6\xbe\x13\xc4\
-\xff\x02\x90\x12\x93y$\xf1\xc8X\x92\xcf\x1f\x84]\x8c\
-\xc2\xe5\x09\x22\x12K\xa3\xf4\xc3\xefM4u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\xb3\xc7\xe3\x81\xdb\xed\xc6\xf1\x13\xaf%\
-\x9f}\xa1\x9cL;\x98\x8a\x99\x8e>\xc9xG\x00\x95\
-J\xc5\x01\xa4\x15.\xcd7\x19RR:\xf7)\xb5\xc3\
-\xe1\xe0\x22\xe3\xc5\xc5E\x0e\xf5\xe2\xf1\x97\x5c\xf4\x1e\xb9\
-\x93\xe9\xae\x00---n\xe9`\xa1\xd4\xd2\x97\x0d\x8d\
-\x97\x97\x97\xe1\xf3\xf9`\xb3\xd9\xf8}ii\x89C\x10\
-\x00\x8d\x0b\x0b\x0b\xcd\xb2\x00\xd0\xa2\x92R\x93\x11\x8d\xe9\
-N\xdfxT;5`\xb5Zy\xf5\xd4\x0a\xfd\xce`\
-0$\xf2\xf2\xf2\xee\xb3g\x1c\xd9\x17@SS\x93[\
-\x9agJO\x22\x13\xaa\x9a\xc6\x16\x8b\x997@\x9fG\
-GG#mmm\xde\xfc\xfc|\x13\xfb\xdbA\xa6\xb2\
-\xbd\x9a\xff'@ss3\x9f\x02JG\x10T?U\
-???\xcf\xeb\xd6h4\x91\xba\xba:\xe7\xc3\xb4]\
-L\x1f0\x1d\xcd\xc6xG\x00\xa5R\xe9v:\x9d\xbc\
-bJJo>\x94\xb4\xbe\xbe\xde\x99\x93\x93#\x99\x16\
-gSuV\x00\x8d\x8d\x8dn\x8b\xc5\x82\x81\x81\x81H\
-mm\xad377WV\xd3\xdd\x00\xf8\x7fFL\xc2\
-A\x99n\xd7\xdfC9V\x18\x85p\xc8\x04\x00\x00\x00\
-\x00IEND\xaeB`\x82\
-\x00\x00\x05+\
-\x89\
-PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
-\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
-\x00\x00\x00\x04gAMA\x00\x00\xd6\xd8\xd4OX2\
-\x00\x00\x00\x19tEXtSoftware\
-\x00Adobe ImageRead\
-yq\xc9e<\x00\x00\x04\xbdIDATX\xc3\xed\
-WkL\x93W\x18>#q\xc92\xe9\x16\x97\xa8T\
-e8\x9d\x02\x15\xf6\x03\x872\x93\x01f,[p\xc4\
-0\xff`\xa2.\x1a:\x1dN\x03\xba1\x89[\xb3\x80\
-\xd9\x0c\x84\x02\x19X\x1c\x14\x8b\x85\xb2\x82\x95^\xe4f\
-\x0b\x8e1\xf8\xc3F\xcb-\x81\x15\xdc\xa8\xc2\x1c\x1b\xb7\
-ji\x91\xf2\xee\xbc\x87\xaf\x0c\xdc\xb8\x0da\xd9\xb2\x93\
-<\xed\x97\xf3}\xfd\xde\xe7\xbc\xef\xf3^J\x00\x80\xfc\
-\x93 \xff\x0a\x02t\x09(D\x14\xd9\x14q\x14\x01+\
-F\x80\xae\xddd\xdd\xc6f\x22L\xf8\x95\xc4\x8bG\xc8\
-\xa1\xd3\xf7\xc8\x8e\x97;82a+A \x85\x9c\xbe\
-0H.\xdd\x80\x19@2\xabyM\xf4\xbe\xfbr\x13\
-hd\x06\x91\x04^\xa3Q\xf4\x06\xee\x85G\xf5\xd0\xbd\
-\x83\xcbM \x9b\x9d\xf6@t/\xbd\x162= \x89\
-?H\xa5,\x1b\x01\x8c1y\xc1\xbb\x9d\x88K\xc6\xd7\
-\xc6&\x0e\xa0\x10\xb9\xfdB\xfe\xc5+6F\x8c\x12\x5c\
-N\x02\x93\xa7\xa7\xa7\x0d\xcc\xd39\xb9\x98c6\x14\x0a\
-\xd2\xe4\xa3+A \x8c)\x9e*\xdf7G\xeb\xdc{\
-\xb5\xcc\x89\x9e@D\x96T\x83+,\x0b6FH\x08\
-\x13\xf5d*{.T\x03\x01\xf8\x037\xbf\xc0\x0e4\
-*T\xdfb\x88R\xd5,X\x03t\x1d\x16\x08\x04z\
-EU\xf5\xc8\xa0mt\xc2\xd4s\xf7!\xbesQ\x95\
-\x90\xae\x8f\xd0\x13\xcf\xe5\x94\x83\x87\xb4\x02\x9e\xcc.\x03\
-\xd4\x06\xdd\xaf\x99\xcb\xb0\xaf\xaf\xaf>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x9d\
-\x00\x00\x00\x00IEND\xaeB`\x82\
-\x00\x00\x04\xa3\
-\x89\
-PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\
-\x00\x00 \x00\x00\x00 \x08\x06\x00\x00\x00szz\xf4\
-\x00\x00\x00\x04gAMA\x00\x00\xd6\xd8\xd4OX2\
-\x00\x00\x00\x19tEXtSoftware\
-\x00Adobe ImageRead\
-yq\xc9e<\x00\x00\x045IDATX\xc3\xe5\
-\x97\xcd\x8fTE\x14\xc5\x7f\xb7\xea\xd6{\xaf\xdbn\xc7\
-\xf9@\x9d\x89FM4\x99D\x8d\x1aH\x98\xc4\x8c\x1f\
-\x1b\xfe\x02L\x5c\xf1\x07\x18\x16.M\x5ckX\xc3\x8e\
-\xc4\x8d\x1b\x17\xce\x82htA\x5c\x18\x0d\xe2\xc4\xc6\x00\
-=`PQ\x19`\x02\xa2\x0e\x0c\x83\xd3\xfd^\xf7\x94\
-\x8b\xaa\xee\xf9`\xe6\x0d\x84Q\x16VR\xa9\xce{\xb7\
-\xeb\x9e:\xf7\xd4\xa9z\xea\xbd\xe7~6\xe5>\xb7>\
-\x80]\xbbv\xbd\x03\xec\xfd\x8f\xf2N5\x1a\x8d\x03\xeb\
-\x19\xd8\xbb\xef\xbd\xa3;\x1f\x1fv\x00\x9c<:\xcf\xcc\
-\x977X\x9c\xef\xdcS\xa6\xda\xa0\xf2\xdck\x03\xbc\xb8\
-g\x10\x80\x8b\x7f\x16|\xf8\xee\x1e\x80\xdb\x00p\xfc\xec\
-\x1c\xdf?0\x04x.\xfd\xb8\xc0\xfe\xb7\xceo\xcbr\
-\x0f\x1dy\x9a\x0b#\x96\xd3\x9f\x1fd\xfc\xd5}\x9bk\
-@E\xb0\x16@xp,#\xcb\xb2m\x0100\x96\
-a\x8dP\x1b|\x14#%\x22\x14+\xd8\x18\x91\xd5\x95\
-s\xe7\xce\x83*\xb8\x04\xd2\x14\xb2\x0c\xd2,\x8cI\x0a\
-I\x12\xdew:\x90\xe7\x90\xb7\xa1\xd5\x82v+\x8em\
-(r\xb2\xfa8\xd6\x0a\xe3\xaf\xbcIk\xf1\xfa\xe6\x00\
-\xac\x15\xac\x15\x04\xb0F\xd8\xbd{\xe7\x16k\xeb\x86\xae\
-\x80Z\xa8V\x81\xeamQ\x8d\xaf\x04\xb5\x82\xf7\xa0\xa6\
-\x84\x01g\x055\x82\x08\xa8\x0a\x95,\xc3# \x1e\x08\
-\xc0\xf0\x1e/\x02\xde#\x12&\x15|\x88#\xc4!\x1e\
-<!^@MX\x18@\xd7J\x89\x06\xac\xa0\xdac\
-\x00\x9a3\xbf\x05\x8aS\x07i\x02\x95\x04\xb24\xf6\x04\
-\x12\x07N\xa1\xe8@^@+\x8f\xbd\x05K9\xb4s\
-\xc8\x0bT\x87q=\x00*\xe5%p1@\xd509\
-\xf9\xd2\xd6\x0a\xf3>\xd0\xaf\x16\xaa\x1b\x8b\xf6\xd8'a\
-a\xbd\x1c%% \x00\xf0\x81\x8d4M\xa3:\xc3\xb3\
-\x98\x11\x89l\x07\xdac\x09V\x98_)F\xfca\xcd\
-r\x7fa\x1d-\xd1\x80:\x09TI\x18O4/\xe0\
-\x9d\x85\xc4!\x89\xc3g\x09\x92i\xd8\x11\x89\xe2\x13\x87\
-X\x8b\xefv\x91\xbc\x80\xbc\x03\xed\x02\xdfj#\xed\x02\
-\xf2\x02\x9fwP\x1dE\xd5 x:\xebTx\x9b\x06\
-\x9c3x\x0f\x03\x8f$\xbc\xfe\xf2\xf3wh\xe86h\
-\xa4\xbe\xf1\xeb\xc6\xfc\xdf\xb1\x04R^\x82DM_\x84\
-\x8f\x0d\xa58\xe7\xb6\xc5\x88\x9e\x18K\xb9v\xb3\x03\x08\
-\x9dR\x11\xaa\x90\xb8P\xefZ\xc50}\xb1\xcb@\xc5\
-\xb0\x0e\xf4&\xadW\xf9U.\xe1\xe1\xc6\xd22\xf5\xcc\
-p}\xc9\x84-\xe9J\x19\x10\x9c\x1a\xc0s\xe5f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\xc8f\xc7\
-\x81':\xf1*\xe75\x1e2\x81\x14(\xbap\xf9\xea\
-U\xce4\x8e\xd1\xfc\xfa\x8b\xb9\xd9\x1fN\x1d\x02\x0eo\
-\x08\xe0\xb3\x8f>\xe0\xa7\xd3'W\x99\xe9\xda\xa3\x86U\
-\xe6\xbb\x1e\x04\x1b<_\x1do|w\xee\x8f\xd9_\x0e\
-\x01\x87\x1b\x8d\xc6_\x1b\x01\x98\x9a\xfe\xf4\xe3\x7f\xf5s\
-l}\xf25\x00\xe2\xb7\xda\x81\xff\xdd\xd7\xf1?M\xf0\
-K\xb9\xe8F\x89\xaf\x00\x00\x00\x00IEND\xaeB\
-`\x82\
-"
-
-qt_resource_name = b"\
-\x00\x06\
-\x07\x03}\xc3\
-\x00i\
-\x00m\x00a\x00g\x00e\x00s\
-\x00\x08\
-\x06\xc1Y\x87\
-\x00o\
-\x00p\x00e\x00n\x00.\x00p\x00n\x00g\
-\x00\x07\
-\x04\xcaW\xa7\
-\x00n\
-\x00e\x00w\x00.\x00p\x00n\x00g\
-\x00\x08\
-\x06|Z\x07\
-\x00c\
-\x00o\x00p\x00y\x00.\x00p\x00n\x00g\
-\x00\x07\
-\x0a\xc7W\x87\
-\x00c\
-\x00u\x00t\x00.\x00p\x00n\x00g\
-\x00\x09\
-\x0a\xa8\xbaG\
-\x00p\
-\x00a\x00s\x00t\x00e\x00.\x00p\x00n\x00g\
-\x00\x08\
-\x08\xc8Xg\
-\x00s\
-\x00a\x00v\x00e\x00.\x00p\x00n\x00g\
-"
-
-qt_resource_struct = b"\
-\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
-\x00\x00\x00\x00\x00\x00\x00\x00\
-\x00\x00\x00\x00\x00\x02\x00\x00\x00\x06\x00\x00\x00\x02\
-\x00\x00\x00\x00\x00\x00\x00\x00\
-\x00\x00\x00(\x00\x00\x00\x00\x00\x01\x00\x00\x08\x1d\
-\x00\x00\x01z\xe7\xee'\x09\
-\x00\x00\x00<\x00\x00\x00\x00\x00\x01\x00\x00\x0bu\
-\x00\x00\x01z\xe7\xee'\x09\
-\x00\x00\x00\x12\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
-\x00\x00\x01z\xe7\xee'\x09\
-\x00\x00\x00~\x00\x00\x00\x00\x00\x01\x00\x00\x1cS\
-\x00\x00\x01z\xe7\xee'\x09\
-\x00\x00\x00f\x00\x00\x00\x00\x00\x01\x00\x00\x15\xe2\
-\x00\x00\x01z\xe7\xee'\x09\
-\x00\x00\x00R\x00\x00\x00\x00\x00\x01\x00\x00\x10\xb3\
-\x00\x00\x01z\xe7\xee'\x09\
-"
-
-def qInitResources():
- QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
-
-def qCleanupResources():
- QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
-
-qInitResources()
diff --git a/examples/widgets/painting/basicdrawing/basicdrawing.py b/examples/widgets/painting/basicdrawing/basicdrawing.py
index c1f2a5b0c..858a8cd9f 100644
--- a/examples/widgets/painting/basicdrawing/basicdrawing.py
+++ b/examples/widgets/painting/basicdrawing/basicdrawing.py
@@ -6,11 +6,12 @@
from PySide6.QtCore import QPoint, QRect, QSize, Qt, qVersion
from PySide6.QtGui import (QBrush, QConicalGradient, QLinearGradient, QPainter,
- QPainterPath, QPalette, QPen, QPixmap, QPolygon, QRadialGradient)
+ QPainterPath, QPalette, QPen, QPixmap, QPolygon,
+ QRadialGradient)
from PySide6.QtWidgets import (QApplication, QCheckBox, QComboBox, QGridLayout,
- QLabel, QSpinBox, QWidget)
+ QLabel, QSpinBox, QWidget)
-import basicdrawing_rc
+import basicdrawing_rc # noqa: F401
class RenderArea(QWidget):
@@ -190,12 +191,9 @@ class Window(QWidget):
pen_join_label.setBuddy(self._pen_join_combo_box)
self._brush_style_combo_box = QComboBox()
- self._brush_style_combo_box.addItem("Linear Gradient",
- Qt.LinearGradientPattern)
- self._brush_style_combo_box.addItem("Radial Gradient",
- Qt.RadialGradientPattern)
- self._brush_style_combo_box.addItem("Conical Gradient",
- Qt.ConicalGradientPattern)
+ self._brush_style_combo_box.addItem("Linear Gradient", Qt.LinearGradientPattern)
+ self._brush_style_combo_box.addItem("Radial Gradient", Qt.RadialGradientPattern)
+ self._brush_style_combo_box.addItem("Conical Gradient", Qt.ConicalGradientPattern)
self._brush_style_combo_box.addItem("Texture", Qt.TexturePattern)
self._brush_style_combo_box.addItem("Solid", Qt.SolidPattern)
self._brush_style_combo_box.addItem("Horizontal", Qt.HorPattern)
@@ -260,24 +258,23 @@ class Window(QWidget):
self.setWindowTitle("Basic Drawing")
def shape_changed(self):
- shape = self._shape_combo_box.itemData(self._shape_combo_box.currentIndex(),
- id_role)
+ shape = self._shape_combo_box.itemData(self._shape_combo_box.currentIndex(), id_role)
self._render_area.set_shape(shape)
def pen_changed(self):
width = self._pen_width_spin_box.value()
style = Qt.PenStyle(self._pen_style_combo_box.itemData(
- self._pen_style_combo_box.currentIndex(), id_role))
+ self._pen_style_combo_box.currentIndex(), id_role))
cap = Qt.PenCapStyle(self._pen_cap_combo_box.itemData(
- self._pen_cap_combo_box.currentIndex(), id_role))
+ self._pen_cap_combo_box.currentIndex(), id_role))
join = Qt.PenJoinStyle(self._pen_join_combo_box.itemData(
- self._pen_join_combo_box.currentIndex(), id_role))
+ self._pen_join_combo_box.currentIndex(), id_role))
self._render_area.set_pen(QPen(Qt.blue, width, style, cap, join))
def brush_changed(self):
style = Qt.BrushStyle(self._brush_style_combo_box.itemData(
- self._brush_style_combo_box.currentIndex(), id_role))
+ self._brush_style_combo_box.currentIndex(), id_role))
if style == Qt.LinearGradientPattern:
linear_gradient = QLinearGradient(0, 0, 100, 100)
diff --git a/examples/widgets/painting/basicdrawing/basicdrawing.pyproject b/examples/widgets/painting/basicdrawing/basicdrawing.pyproject
index 9ecbfadcf..976bb9e35 100644
--- a/examples/widgets/painting/basicdrawing/basicdrawing.pyproject
+++ b/examples/widgets/painting/basicdrawing/basicdrawing.pyproject
@@ -1,3 +1,3 @@
{
- "files": ["basicdrawing_rc.py", "basicdrawing.qrc", "basicdrawing.py"]
+ "files": ["basicdrawing.qrc", "basicdrawing.py"]
}
diff --git a/examples/widgets/painting/concentriccircles/concentriccircles.py b/examples/widgets/painting/concentriccircles/concentriccircles.py
index 0edc9cb9f..d2c60178f 100644
--- a/examples/widgets/painting/concentriccircles/concentriccircles.py
+++ b/examples/widgets/painting/concentriccircles/concentriccircles.py
@@ -2,12 +2,13 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-"""PySide6 port of the widgets/painting/concentriccircles example from Qt v5.x, originating from PyQt"""
+"""PySide6 port of the widgets/painting/concentriccircles example from Qt v5.x, originating
+ from PyQt"""
from PySide6.QtCore import QRect, QRectF, QSize, Qt, QTimer
from PySide6.QtGui import QColor, QPainter, QPalette, QPen
from PySide6.QtWidgets import (QApplication, QFrame, QGridLayout, QLabel,
- QSizePolicy, QWidget)
+ QSizePolicy, QWidget)
class CircleWidget(QWidget):
@@ -52,10 +53,10 @@ class CircleWidget(QWidget):
if self._float_based:
painter.drawEllipse(QRectF(-diameter / 2.0,
- -diameter / 2.0, diameter, diameter))
+ -diameter / 2.0, diameter, diameter))
else:
painter.drawEllipse(QRect(-diameter / 2,
- -diameter / 2, diameter, diameter))
+ -diameter / 2, diameter, diameter))
class Window(QWidget):
diff --git a/examples/widgets/painting/painter/painter.py b/examples/widgets/painting/painter/painter.py
index 58584baff..2ca078ad9 100644
--- a/examples/widgets/painting/painter/painter.py
+++ b/examples/widgets/painting/painter/painter.py
@@ -116,15 +116,17 @@ class MainWindow(QMainWindow):
self.bar = self.addToolBar("Menu")
self.bar.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
self._save_action = self.bar.addAction(
- qApp.style().standardIcon(QStyle.SP_DialogSaveButton), "Save", self.on_save
+ qApp.style().standardIcon(QStyle.SP_DialogSaveButton), # noqa: F821
+ "Save", self.on_save
)
self._save_action.setShortcut(QKeySequence.Save)
self._open_action = self.bar.addAction(
- qApp.style().standardIcon(QStyle.SP_DialogOpenButton), "Open", self.on_open
+ qApp.style().standardIcon(QStyle.SP_DialogOpenButton), # noqa: F821
+ "Open", self.on_open
)
self._open_action.setShortcut(QKeySequence.Open)
self.bar.addAction(
- qApp.style().standardIcon(QStyle.SP_DialogResetButton),
+ qApp.style().standardIcon(QStyle.SP_DialogResetButton), # noqa: F821
"Clear",
self.painter_widget.clear,
)
diff --git a/examples/widgets/rhi/simplerhiwidget/doc/simplerhiwidget.rst b/examples/widgets/rhi/simplerhiwidget/doc/simplerhiwidget.rst
new file mode 100644
index 000000000..c33c6660a
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/doc/simplerhiwidget.rst
@@ -0,0 +1,34 @@
+.. _rhi-widget-example:
+
+Simple RHI Widget Example
+=========================
+
+Shows how to render a triangle using ``QRhi``, Qt's 3D API and shading
+language abstraction layer.
+
+This example is, in many ways, the counterpart of the :ref:`rhi-window-example`
+in the QWidget world. The ``QRhiWidget`` subclass in this applications renders
+a single triangle, using a simple graphics pipeline with basic vertex and
+fragment shaders. Unlike the plain ``QWindow``-based application, this example
+does not need to worry about lower level details, such as setting up the window
+and the ``QRhi``, or dealing with swapchain and window events, as that is taken
+care of by the ``QWidget`` framework here. The instance of the ``QRhiWidget``
+subclass is added to a ``QVBoxLayout``. To keep the example minimal and
+compact, there are no further widgets or 3D content introduced.
+
+Once an instance of ``ExampleRhiWidget``, a ``QRhiWidget`` subclass, is added
+to a top-level widget's child hierarchy, the corresponding window automatically
+becomes a Direct 3D, Vulkan, Metal, or OpenGL-rendered window. The
+``QPainter``-rendered widget content, i.e. everything that is not a
+``QRhiWidget``, ``QOpenGLWidget``, or ``QQuickWidget``, is then uploaded to a
+texture, whereas the mentioned special widgets each render to a texture. The
+resulting set textures is composited together by the top-level widget's
+backingstore.
+
+As opposed to the C++ example, the cleanup is done by reimplementing
+``QRhiWidget.releaseResources()``, which is called from QWidget.closeEvent() of
+the top level widget to ensure a deterministic cleanup sequence.
+
+.. image:: simplerhiwidget.webp
+ :width: 400
+ :alt: Screenshot of the Simple RHI Widget example
diff --git a/examples/widgets/rhi/simplerhiwidget/doc/simplerhiwidget.webp b/examples/widgets/rhi/simplerhiwidget/doc/simplerhiwidget.webp
new file mode 100644
index 000000000..fdb8d20ec
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/doc/simplerhiwidget.webp
Binary files differ
diff --git a/examples/widgets/rhi/simplerhiwidget/examplewidget.py b/examples/widgets/rhi/simplerhiwidget/examplewidget.py
new file mode 100644
index 000000000..5b3e40f50
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/examplewidget.py
@@ -0,0 +1,135 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import numpy
+
+from PySide6.QtCore import (QFile, QIODevice)
+from PySide6.QtGui import (QColor, QMatrix4x4)
+from PySide6.QtGui import (QRhiBuffer,
+ QRhiDepthStencilClearValue,
+ QRhiShaderResourceBinding,
+ QRhiShaderStage,
+ QRhiVertexInputAttribute, QRhiVertexInputBinding,
+ QRhiVertexInputLayout, QRhiViewport,
+ QShader)
+from PySide6.QtWidgets import QRhiWidget
+from PySide6.support import VoidPtr
+
+VERTEX_DATA = numpy.array([ 0.0, 0.5, 1.0, 0.0, 0.0, # noqa E:201
+ -0.5, -0.5, 0.0, 1.0, 0.0, # noqa E:241
+ 0.5, -0.5, 0.0, 0.0, 1.0],
+ dtype=numpy.float32)
+
+
+def getShader(name):
+ f = QFile(name)
+ if f.open(QIODevice.ReadOnly):
+ return QShader.fromSerialized(f.readAll())
+ return QShader()
+
+
+class ExampleRhiWidget(QRhiWidget):
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ self.m_rhi = None
+ self.m_vbuf = None
+ self.m_ubuf = None
+ self.m_srb = None
+ self.m_pipeline = None
+ self.m_viewProjection = QMatrix4x4()
+ self.m_rotation = 0.0
+
+ def releaseResources(self):
+ self.m_pipeline.destroy()
+ del self.m_pipeline
+ self.m_pipeline = None
+ self.m_srb.destroy()
+ del self.m_srb
+ self.m_srb = None
+ self.m_ubuf.destroy()
+ del self.m_ubuf
+ self.m_ubuf = None
+ self.m_vbuf.destroy()
+ del self.m_vbuf
+ self.m_buf = None
+
+ def initialize(self, cb):
+ if self.m_rhi != self.rhi():
+ self.m_pipeline = None
+ self.m_rhi = self.rhi()
+
+ if not self.m_pipeline:
+ vertex_size = 4 * VERTEX_DATA.size
+ self.m_vbuf = self.m_rhi.newBuffer(QRhiBuffer.Immutable,
+ QRhiBuffer.VertexBuffer, vertex_size)
+ self.m_vbuf.create()
+
+ self.m_ubuf = self.m_rhi.newBuffer(QRhiBuffer.Dynamic,
+ QRhiBuffer.UniformBuffer, 64)
+ self.m_ubuf.create()
+
+ self.m_srb = self.m_rhi.newShaderResourceBindings()
+ bindings = [
+ QRhiShaderResourceBinding.uniformBuffer(0, QRhiShaderResourceBinding.VertexStage,
+ self.m_ubuf)
+ ]
+ self.m_srb.setBindings(bindings)
+ self.m_srb.create()
+
+ self.m_pipeline = self.m_rhi.newGraphicsPipeline()
+ stages = [
+ QRhiShaderStage(QRhiShaderStage.Vertex,
+ getShader(":/shader_assets/color.vert.qsb")),
+ QRhiShaderStage(QRhiShaderStage.Fragment,
+ getShader(":/shader_assets/color.frag.qsb"))
+ ]
+ self.m_pipeline.setShaderStages(stages)
+ inputLayout = QRhiVertexInputLayout()
+ input_bindings = [QRhiVertexInputBinding(5 * 4)] # sizeof(float)
+ inputLayout.setBindings(input_bindings)
+ attributes = [ # 4: sizeof(float)
+ QRhiVertexInputAttribute(0, 0, QRhiVertexInputAttribute.Float2, 0),
+ QRhiVertexInputAttribute(0, 1, QRhiVertexInputAttribute.Float3, 2 * 4)
+ ]
+ inputLayout.setAttributes(attributes)
+ self.m_pipeline.setVertexInputLayout(inputLayout)
+ self.m_pipeline.setShaderResourceBindings(self.m_srb)
+ self.m_pipeline.setRenderPassDescriptor(self.renderTarget().renderPassDescriptor())
+ self.m_pipeline.create()
+
+ resourceUpdates = self.m_rhi.nextResourceUpdateBatch()
+ resourceUpdates.uploadStaticBuffer(self.m_vbuf, VoidPtr(VERTEX_DATA.tobytes(),
+ vertex_size))
+ cb.resourceUpdate(resourceUpdates)
+
+ outputSize = self.renderTarget().pixelSize()
+ self.m_viewProjection = self.m_rhi.clipSpaceCorrMatrix()
+ r = float(outputSize.width()) / float(outputSize.height())
+ self.m_viewProjection.perspective(45.0, r, 0.01, 1000.0)
+ self.m_viewProjection.translate(0, 0, -4)
+
+ def render(self, cb):
+ resourceUpdates = self.m_rhi.nextResourceUpdateBatch()
+ self.m_rotation += 1.0
+ modelViewProjection = self.m_viewProjection
+ modelViewProjection.rotate(self.m_rotation, 0, 1, 0)
+ projection = numpy.array(modelViewProjection.data(),
+ dtype=numpy.float32)
+ resourceUpdates.updateDynamicBuffer(self.m_ubuf, 0, 64,
+ projection.tobytes())
+ clearColor = QColor.fromRgbF(0.4, 0.7, 0.0, 1.0)
+ cv = QRhiDepthStencilClearValue(1.0, 0)
+ cb.beginPass(self.renderTarget(), clearColor, cv, resourceUpdates)
+
+ cb.setGraphicsPipeline(self.m_pipeline)
+ outputSize = self.renderTarget().pixelSize()
+ cb.setViewport(QRhiViewport(0, 0, outputSize.width(),
+ outputSize.height()))
+ cb.setShaderResources()
+ vbufBinding = (self.m_vbuf, 0)
+ cb.setVertexInput(0, [vbufBinding])
+ cb.draw(3)
+ cb.endPass()
+
+ self.update()
diff --git a/examples/widgets/rhi/simplerhiwidget/main.py b/examples/widgets/rhi/simplerhiwidget/main.py
new file mode 100644
index 000000000..59be81ddc
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/main.py
@@ -0,0 +1,35 @@
+# Copyright (C) 2024 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+"""PySide6 port of the Qt Simple RHI Widget Example example from Qt v6.x"""
+
+import sys
+
+from PySide6.QtWidgets import QApplication, QVBoxLayout, QWidget
+
+from examplewidget import ExampleRhiWidget
+import rc_simplerhiwidget # noqa F:401
+
+
+class Widget(QWidget):
+
+ def __init__(self, parent=None):
+ super().__init__(parent)
+ layout = QVBoxLayout(self)
+ self._rhi_widget = ExampleRhiWidget(self)
+ layout.addWidget(self._rhi_widget)
+
+ def closeEvent(self, e):
+ self._rhi_widget.releaseResources()
+ e.accept()
+
+
+if __name__ == "__main__":
+ app = QApplication(sys.argv)
+
+ w = Widget()
+ w.resize(1280, 720)
+ w.show()
+ exit_code = app.exec()
+ del w
+ sys.exit(exit_code)
diff --git a/examples/widgets/rhi/simplerhiwidget/rc_simplerhiwidget.py b/examples/widgets/rhi/simplerhiwidget/rc_simplerhiwidget.py
new file mode 100644
index 000000000..ee8b41242
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/rc_simplerhiwidget.py
@@ -0,0 +1,163 @@
+# Resource object code (Python 3)
+# Created by: object code
+# Created by: The Resource Compiler for Qt version 6.7.0
+# WARNING! All changes made in this file will be lost!
+
+from PySide6 import QtCore
+
+qt_resource_data = b"\
+\x00\x00\x02\xe2\
+\x00\
+\x00\x07\xc4x\x9c\xb5T]k\xd4@\x14\x9d\xed\xa6]\
+\x9b\xd6\xda\x0f\xd07\x19\xe9\xcb\x16%\xa6\xb5\x15q\xdd\
+\xfa\xb0U)\x14Z\xdbR\x84e\x091\x9bM\x07\xb2\
+\xc9\x92\x8fE)\x05\xdf}\xf7w\xf8'\xfcO\xbe\x88\
+\xde;s\xd3\xcc\xa6[*\x88\x03\xb3\x999s\xef=\
+g\xceM\x9616\xcf\x183`\xd6`.\xb11s\
+\x98\xc7b\x16\xc2L\x00\xa9\xc3d\xbfi\xb0)\x03\xd3\
+V\xd9\x00\x82]\x16\xb0\x8e\x96j\xdc\x96\xfa\xafc\x8e\
+\x9e}M\xcd\xf7\xfa\xccz\x03U\x99\x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\x900\xd3\
+\xc7\x0b]%\xecw=\xe30\x0b\xda\xba\xb6{\xfa(\
+:\xf2\x9c\xe7sV\x1d4\xc7\x14\x07n\xcf<\xdb\xc7\
+\xb5\x86\xd6\xc0\x86\xa9k$1)20=\x8ac\x91\
+\xe9\x17\x05)\xc5\x82\x8c\xd4\xeeX\x0a\xca\xc9\xd4t\xcb\
+\xc5\x96\x9ag\xce\xb7`+\xef$\xd9\xb1\x9e\xc8\x92\xa8\
+\x0243oA\x93~{\xd0\xa8\xfd\xd9\xf2#7\xc8\
+F\x1e\xff2\xf4\x84\x13\xd8\xf0WR\xe0\x0f\x8f\xacB\
+\x9f\xfa\xe1\xe83\xfc\xd1}q\x04w<\xc5\xc7+r\
+B/\x85+\xe0q\xb9\xab\xbf\xe0i\xc8\xefL\xfe<\
+\x90\x0bf\xd2\xc3\xec\x16\xb7\xd5`\x90\xa5p\x0d\x83\xd8\
+\x8dz\x9d\xd3\xd3\x0b[k0\xd0'\x80Ns\xf1\xfd\
+\xe8\x82K1\x18\xe4\xafj\xbb\x02\xa0o\x86\xe9\xb2\xdb\
+\xd1\xe1\xf1\x88\xbd\xf3\x22}\xb5jk8\xeecl\xdd\
+!\xa7\xa7\xf7 X\x04b$I\xf9\x18\xfb\x15\xec\xea\
+\xcd\x91\xc0\x9d\xfc\x0d\xd5\x01q\x1e\xf2W3\x95R\x5c\
+:g?2{2\x9e\xeb\x97\xe2\x01\x04\xcfroR\
+W\xc4\xaa\x19\xb0\x1b\x96$&=\x8a\x95\x871\xff\xad\
+\xce\xe8\xbf\x83J\xcb\xcc\xd9\xb5\xae\xea'\xc7\xdf%\xe1\
+\xb4\xa2\
+"
+
+qt_resource_name = b"\
+\x00\x0d\
+\x06E\xc5\xd3\
+\x00s\
+\x00h\x00a\x00d\x00e\x00r\x00_\x00a\x00s\x00s\x00e\x00t\x00s\
+\x00\x0e\
+\x04\x16\xeb\xb2\
+\x00c\
+\x00o\x00l\x00o\x00r\x00.\x00f\x00r\x00a\x00g\x00.\x00q\x00s\x00b\
+\x00\x0e\
+\x00\xfb\xe9\x92\
+\x00c\
+\x00o\x00l\x00o\x00r\x00.\x00v\x00e\x00r\x00t\x00.\x00q\x00s\x00b\
+"
+
+qt_resource_struct = b"\
+\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
+\x00\x00\x00\x00\x00\x00\x00\x00\
+\x00\x00\x00\x00\x00\x02\x00\x00\x00\x02\x00\x00\x00\x02\
+\x00\x00\x00\x00\x00\x00\x00\x00\
+\x00\x00\x00B\x00\x00\x00\x00\x00\x01\x00\x00\x02\xe6\
+\x00\x00\x01\x8a!\x0c\xa5\xeb\
+\x00\x00\x00 \x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
+\x00\x00\x01\x8a!\x0c\xa5\xeb\
+"
+
+def qInitResources():
+ QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
+
+def qCleanupResources():
+ QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data)
+
+qInitResources()
diff --git a/examples/widgets/rhi/simplerhiwidget/shader_assets/color.frag.qsb b/examples/widgets/rhi/simplerhiwidget/shader_assets/color.frag.qsb
new file mode 100644
index 000000000..32bd2d595
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/shader_assets/color.frag.qsb
Binary files differ
diff --git a/examples/widgets/rhi/simplerhiwidget/shader_assets/color.vert.qsb b/examples/widgets/rhi/simplerhiwidget/shader_assets/color.vert.qsb
new file mode 100644
index 000000000..bf97035d7
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/shader_assets/color.vert.qsb
Binary files differ
diff --git a/examples/widgets/rhi/simplerhiwidget/shaders/color.frag b/examples/widgets/rhi/simplerhiwidget/shaders/color.frag
new file mode 100644
index 000000000..375587662
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/shaders/color.frag
@@ -0,0 +1,10 @@
+#version 440
+
+layout(location = 0) in vec3 v_color;
+
+layout(location = 0) out vec4 fragColor;
+
+void main()
+{
+ fragColor = vec4(v_color, 1.0);
+}
diff --git a/examples/widgets/rhi/simplerhiwidget/shaders/color.vert b/examples/widgets/rhi/simplerhiwidget/shaders/color.vert
new file mode 100644
index 000000000..e876f290e
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/shaders/color.vert
@@ -0,0 +1,16 @@
+#version 440
+
+layout(location = 0) in vec4 position;
+layout(location = 1) in vec3 color;
+
+layout(location = 0) out vec3 v_color;
+
+layout(std140, binding = 0) uniform buf {
+ mat4 mvp;
+};
+
+void main()
+{
+ v_color = color;
+ gl_Position = mvp * position;
+}
diff --git a/examples/widgets/rhi/simplerhiwidget/simplerhiwidget.pyproject b/examples/widgets/rhi/simplerhiwidget/simplerhiwidget.pyproject
new file mode 100644
index 000000000..ff0d62755
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/simplerhiwidget.pyproject
@@ -0,0 +1,4 @@
+{
+ "files": ["main.py","examplewidget.py", "simplerhiwidget.qrc",
+ "shaders/color.frag", "shaders/color.vert"]
+}
diff --git a/examples/widgets/rhi/simplerhiwidget/simplerhiwidget.qrc b/examples/widgets/rhi/simplerhiwidget/simplerhiwidget.qrc
new file mode 100644
index 000000000..ddc6dfbe5
--- /dev/null
+++ b/examples/widgets/rhi/simplerhiwidget/simplerhiwidget.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file>shader_assets/color.vert.qsb</file>
+ <file>shader_assets/color.frag.qsb</file>
+</qresource>
+</RCC>
diff --git a/examples/widgets/richtext/orderform/orderform.py b/examples/widgets/richtext/orderform/orderform.py
index fd0be01fe..9725624c3 100644
--- a/examples/widgets/richtext/orderform/orderform.py
+++ b/examples/widgets/richtext/orderform/orderform.py
@@ -89,8 +89,7 @@ class MainWindow(QMainWindow):
body_frame_format.setWidth(QTextLength(QTextLength.PercentageLength, 100))
cursor.insertFrame(body_frame_format)
- cursor.insertText("I would like to place an order for the following "
- "items:", text_format)
+ cursor.insertText("I would like to place an order for the following items:", text_format)
cursor.insertBlock()
cursor.insertBlock()
@@ -121,17 +120,17 @@ class MainWindow(QMainWindow):
cursor.insertBlock()
cursor.insertText("Please update my records to take account of the "
- "following privacy information:")
+ "following privacy information:")
cursor.insertBlock()
offers_table = cursor.insertTable(2, 2)
cursor = offers_table.cellAt(0, 1).firstCursorPosition()
cursor.insertText("I want to receive more information about your "
- "company's products and special offers.", text_format)
+ "company's products and special offers.", text_format)
cursor = offers_table.cellAt(1, 1).firstCursorPosition()
cursor.insertText("I do not want to receive any promotional "
- "information from your company.", text_format)
+ "information from your company.", text_format)
if sendOffers:
cursor = offers_table.cellAt(0, 0).firstCursorPosition()
@@ -153,8 +152,8 @@ class MainWindow(QMainWindow):
def create_sample(self):
dialog = DetailsDialog('Dialog with default values', self)
self.create_letter('Mr Smith',
- '12 High Street\nSmall Town\nThis country',
- dialog.order_items(), True)
+ '12 High Street\nSmall Town\nThis country',
+ dialog.order_items(), True)
@Slot()
def open_dialog(self):
@@ -162,7 +161,7 @@ class MainWindow(QMainWindow):
if dialog.exec() == QDialog.Accepted:
self.create_letter(dialog.sender_name(), dialog.sender_address(),
- dialog.order_items(), dialog.send_offers())
+ dialog.order_items(), dialog.send_offers())
@Slot()
def print_file(self):
@@ -193,8 +192,7 @@ class DetailsDialog(QDialog):
self._name_edit = QLineEdit()
self._address_edit = QTextEdit()
- self._offers_check_box = QCheckBox("Send information about "
- "products and special offers:")
+ self._offers_check_box = QCheckBox("Send information about products and special offers:")
self.setup_items_table()
@@ -250,9 +248,9 @@ class DetailsDialog(QDialog):
return
answer = QMessageBox.warning(self, "Incomplete Form",
- "The form does not contain all the necessary information.\n"
- "Do you want to discard it?",
- QMessageBox.Yes, QMessageBox.No)
+ "The form does not contain all the necessary information.\n"
+ "Do you want to discard it?",
+ QMessageBox.Yes, QMessageBox.No)
if answer == QMessageBox.Yes:
self.reject()
diff --git a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py
index c329eefd6..021328977 100644
--- a/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py
+++ b/examples/widgets/richtext/syntaxhighlighter/syntaxhighlighter.py
@@ -12,7 +12,7 @@ from PySide6.QtCore import (QFile, Qt, QTextStream)
from PySide6.QtGui import (QColor, QFont, QFontDatabase, QKeySequence,
QSyntaxHighlighter, QTextCharFormat)
from PySide6.QtWidgets import (QApplication, QFileDialog, QMainWindow,
- QPlainTextEdit)
+ QPlainTextEdit)
class MainWindow(QMainWindow):
@@ -81,7 +81,7 @@ class MainWindow(QMainWindow):
quit_act.triggered.connect(self.close)
help_menu = self.menuBar().addMenu("&Help")
- help_menu.addAction("About &Qt", qApp.aboutQt)
+ help_menu.addAction("About &Qt", qApp.aboutQt) # noqa: F821
class Highlighter(QSyntaxHighlighter):
diff --git a/examples/widgets/richtext/textedit/main.py b/examples/widgets/richtext/textedit/main.py
index 88b679edc..330ea5fc5 100644
--- a/examples/widgets/richtext/textedit/main.py
+++ b/examples/widgets/richtext/textedit/main.py
@@ -11,7 +11,7 @@ from PySide6.QtWidgets import QApplication
from textedit import TextEdit
-import textedit_rc
+import textedit_rc # noqa: F401
if __name__ == '__main__':
diff --git a/examples/widgets/richtext/textedit/textedit.py b/examples/widgets/richtext/textedit/textedit.py
index 4f4146d34..8019446f0 100644
--- a/examples/widgets/richtext/textedit/textedit.py
+++ b/examples/widgets/richtext/textedit/textedit.py
@@ -55,7 +55,7 @@ class TextEdit(QMainWindow):
help_menu = self.menuBar().addMenu("Help")
help_menu.addAction("About", self.about)
- help_menu.addAction("About &Qt", qApp.aboutQt)
+ help_menu.addAction("About &Qt", qApp.aboutQt) # noqa: F821
text_font = QFont("Helvetica")
text_font.setStyleHint(QFont.SansSerif)
@@ -101,13 +101,14 @@ class TextEdit(QMainWindow):
tb = self.addToolBar("File self.actions")
menu = self.menuBar().addMenu("&File")
- icon = QIcon.fromTheme("document-new", QIcon(RSRC_PATH + "/filenew.png"))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentNew,
+ QIcon(RSRC_PATH + "/filenew.png"))
a = menu.addAction(icon, "&New", self.file_new)
tb.addAction(a)
a.setPriority(QAction.LowPriority)
a.setShortcut(QKeySequence.New)
- icon = QIcon.fromTheme("document-open",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentOpen,
QIcon(RSRC_PATH + "/fileopen.png"))
a = menu.addAction(icon, "&Open...", self.file_open)
a.setShortcut(QKeySequence.Open)
@@ -115,7 +116,7 @@ class TextEdit(QMainWindow):
menu.addSeparator()
- icon = QIcon.fromTheme("document-save",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentSave,
QIcon(RSRC_PATH + "/filesave.png"))
self._action_save = menu.addAction(icon, "&Save", self.file_save)
self._action_save.setShortcut(QKeySequence.Save)
@@ -126,7 +127,7 @@ class TextEdit(QMainWindow):
a.setPriority(QAction.LowPriority)
menu.addSeparator()
- icon = QIcon.fromTheme("document-print",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.DocumentPrint,
QIcon(RSRC_PATH + "/fileprint.png"))
a = menu.addAction(icon, "&Print...", self.file_print)
a.setPriority(QAction.LowPriority)
@@ -151,32 +152,36 @@ class TextEdit(QMainWindow):
tb = self.addToolBar("Edit self.actions")
menu = self.menuBar().addMenu("&Edit")
- icon = QIcon.fromTheme("edit-undo",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditUndo,
QIcon(RSRC_PATH + "/editundo.png"))
self._action_undo = menu.addAction(icon, "&Undo", self._text_edit.undo)
self._action_undo.setShortcut(QKeySequence.Undo)
tb.addAction(self._action_undo)
- icon = QIcon.fromTheme("edit-redo", QIcon(RSRC_PATH + "/editredo.png"))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditRedo,
+ QIcon(RSRC_PATH + "/editredo.png"))
self._action_redo = menu.addAction(icon, "&Redo", self._text_edit.redo)
self._action_redo.setPriority(QAction.LowPriority)
self._action_redo.setShortcut(QKeySequence.Redo)
tb.addAction(self._action_redo)
menu.addSeparator()
- icon = QIcon.fromTheme("edit-cut", QIcon(RSRC_PATH + "/editcut.png"))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditCut,
+ QIcon(RSRC_PATH + "/editcut.png"))
self._action_cut = menu.addAction(icon, "Cu&t", self._text_edit.cut)
self._action_cut.setPriority(QAction.LowPriority)
self._action_cut.setShortcut(QKeySequence.Cut)
tb.addAction(self._action_cut)
- icon = QIcon.fromTheme("edit-copy", QIcon(RSRC_PATH + "/editcopy.png"))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditCopy,
+ QIcon(RSRC_PATH + "/editcopy.png"))
self._action_copy = menu.addAction(icon, "&Copy", self._text_edit.copy)
self._action_copy.setPriority(QAction.LowPriority)
self._action_copy.setShortcut(QKeySequence.Copy)
tb.addAction(self._action_copy)
- icon = QIcon.fromTheme("edit-paste", QIcon(RSRC_PATH + "/editpaste.png"))
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.EditPaste,
+ QIcon(RSRC_PATH + "/editpaste.png"))
self._action_paste = menu.addAction(icon, "&Paste", self._text_edit.paste)
self._action_paste.setPriority(QAction.LowPriority)
self._action_paste.setShortcut(QKeySequence.Paste)
@@ -190,7 +195,7 @@ class TextEdit(QMainWindow):
tb = self.addToolBar("Format self.actions")
menu = self.menuBar().addMenu("F&ormat")
- icon = QIcon.fromTheme("format-text-bold",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatTextBold,
QIcon(RSRC_PATH + "/textbold.png"))
self._action_text_bold = menu.addAction(icon, "&Bold", self.text_bold)
self._action_text_bold.setShortcut(Qt.CTRL | Qt.Key_B)
@@ -201,7 +206,7 @@ class TextEdit(QMainWindow):
tb.addAction(self._action_text_bold)
self._action_text_bold.setCheckable(True)
- icon = QIcon.fromTheme("format-text-italic",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatTextItalic,
QIcon(RSRC_PATH + "/textitalic.png"))
self._action_text_italic = menu.addAction(icon, "&Italic", self.text_italic)
self._action_text_italic.setPriority(QAction.LowPriority)
@@ -212,7 +217,7 @@ class TextEdit(QMainWindow):
tb.addAction(self._action_text_italic)
self._action_text_italic.setCheckable(True)
- icon = QIcon.fromTheme("format-text-underline",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatTextUnderline,
QIcon(RSRC_PATH + "/textunder.png"))
self._action_text_underline = menu.addAction(icon, "&Underline",
self.text_underline)
@@ -226,36 +231,36 @@ class TextEdit(QMainWindow):
menu.addSeparator()
- icon = QIcon.fromTheme("format-justify-left",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatJustifyLeft,
QIcon(RSRC_PATH + "/textleft.png"))
self._action_align_left = QAction(icon, "&Left", self)
self._action_align_left.setShortcut(Qt.CTRL | Qt.Key_L)
self._action_align_left.setCheckable(True)
self._action_align_left.setPriority(QAction.LowPriority)
- icon = QIcon.fromTheme("format-justify-center",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatJustifyCenter,
QIcon(RSRC_PATH + "/textcenter.png"))
self._action_align_center = QAction(icon, "C&enter", self)
self._action_align_center.setShortcut(Qt.CTRL | Qt.Key_E)
self._action_align_center.setCheckable(True)
self._action_align_center.setPriority(QAction.LowPriority)
- icon = QIcon.fromTheme("format-justify-right",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatJustifyRight,
QIcon(RSRC_PATH + "/textright.png"))
self._action_align_right = QAction(icon, "&Right", self)
self._action_align_right.setShortcut(Qt.CTRL | Qt.Key_R)
self._action_align_right.setCheckable(True)
self._action_align_right.setPriority(QAction.LowPriority)
- icon = QIcon.fromTheme("format-justify-fill",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatJustifyFill,
QIcon(RSRC_PATH + "/textjustify.png"))
self._action_align_justify = QAction(icon, "&Justify", self)
self._action_align_justify.setShortcut(Qt.CTRL | Qt.Key_J)
self._action_align_justify.setCheckable(True)
self._action_align_justify.setPriority(QAction.LowPriority)
- icon = QIcon.fromTheme("format-indent-more",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatIndentMore,
QIcon(RSRC_PATH + "/format-indent-more.png"))
self._action_indent_more = menu.addAction(icon, "&Indent", self.indent)
self._action_indent_more.setShortcut(Qt.CTRL | Qt.Key_BracketRight)
self._action_indent_more.setPriority(QAction.LowPriority)
- icon = QIcon.fromTheme("format-indent-less",
+ icon = QIcon.fromTheme(QIcon.ThemeIcon.FormatIndentLess,
QIcon(RSRC_PATH + "/format-indent-less.png"))
self._action_indent_less = menu.addAction(icon, "&Unindent",
self.unindent)
@@ -621,7 +626,7 @@ class TextEdit(QMainWindow):
above = QTextCursor(cursor)
above.movePosition(QTextCursor.Up)
if (above.currentList()
- and list_fmt.indent() + amount == above.currentList().format().indent()):
+ and list_fmt.indent() + amount == above.currentList().format().indent()):
above.currentList().add(cursor.block())
else:
list_fmt.setIndent(list_fmt.indent() + amount)
diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.py b/examples/widgets/tools/regularexpression/regularexpressiondialog.py
index 4fc9c62a2..2d2bb2bb7 100644
--- a/examples/widgets/tools/regularexpression/regularexpressiondialog.py
+++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.py
@@ -5,12 +5,14 @@ import re
import logging
from PySide6.QtCore import (QMargins, QRegularExpression, QRegularExpressionMatch,
- QRegularExpressionMatchIterator, Qt, Slot,)
+ QRegularExpressionMatchIterator, Qt, Slot,)
from PySide6.QtGui import (QAction, QColor, QContextMenuEvent, QFontDatabase,
- QGuiApplication, QIcon, QPalette,)
+ QGuiApplication, QIcon, QPalette,)
from PySide6.QtWidgets import (QCheckBox, QComboBox, QDialog, QFormLayout,
- QFrame, QGridLayout, QHBoxLayout, QLabel, QLineEdit, QPlainTextEdit,
- QSpinBox, QTreeWidget, QTreeWidgetItem, QVBoxLayout, QWidget,)
+ QFrame, QGridLayout, QHBoxLayout, QLabel,
+ QLineEdit, QPlainTextEdit, QSpinBox,
+ QTreeWidget, QTreeWidgetItem, QVBoxLayout,
+ QWidget)
def rawStringLiteral(pattern: str) -> str:
@@ -42,7 +44,7 @@ def codeToPattern(code: str) -> str:
if code_characters[index] == '\\':
del code_characters[index]
code_characters_size -= 1
- index +=1
+ index += 1
code = "".join(code_characters)
if code.startswith('"') and code.endswith('"'):
@@ -85,7 +87,7 @@ class PatternLineEdit(QLineEdit):
t = (
t[: selection_start]
+ escapedSelection
- + t[selection_start + len(selection) :]
+ + t[selection_start + len(selection):]
)
self.setText(t)
@@ -327,23 +329,20 @@ class RegularExpressionDialog(QDialog):
self.patternOptionsCheckBoxLayout = QGridLayout()
gridRow = 0
- self.patternOptionsCheckBoxLayout.addWidget(self.caseInsensitiveOptionCheckBox, gridRow, \
- 1)
- self.patternOptionsCheckBoxLayout.addWidget(self.dotMatchesEverythingOptionCheckBox, gridRow\
- ,2)
+ self.patternOptionsCheckBoxLayout.addWidget(self.caseInsensitiveOptionCheckBox, gridRow, 1)
+ self.patternOptionsCheckBoxLayout.addWidget(
+ self.dotMatchesEverythingOptionCheckBox, gridRow, 2)
gridRow = gridRow + 1
- self.patternOptionsCheckBoxLayout.addWidget(self.multilineOptionCheckBox, gridRow, \
- 1)
- self.patternOptionsCheckBoxLayout.addWidget(self.extendedPatternSyntaxOptionCheckBox, gridRow \
- , 2)
+ self.patternOptionsCheckBoxLayout.addWidget(self.multilineOptionCheckBox, gridRow, 1)
+ self.patternOptionsCheckBoxLayout.addWidget(
+ self.extendedPatternSyntaxOptionCheckBox, gridRow, 2)
gridRow = gridRow + 1
- self.patternOptionsCheckBoxLayout.addWidget(self.invertedGreedinessOptionCheckBox, gridRow,\
- 1)
- self.patternOptionsCheckBoxLayout.addWidget(self.dontCaptureOptionCheckBox, gridRow,\
- 2)
+ self.patternOptionsCheckBoxLayout.addWidget(
+ self.invertedGreedinessOptionCheckBox, gridRow, 1)
+ self.patternOptionsCheckBoxLayout.addWidget(self.dontCaptureOptionCheckBox, gridRow, 2)
gridRow = gridRow + 1
- self.patternOptionsCheckBoxLayout.addWidget(self.useUnicodePropertiesOptionCheckBox, gridRow,\
- 1)
+ self.patternOptionsCheckBoxLayout.addWidget(
+ self.useUnicodePropertiesOptionCheckBox, gridRow, 1)
form_layout.addRow("Pattern options:", self.patternOptionsCheckBoxLayout)
diff --git a/examples/widgets/tutorials/addressbook/part1.py b/examples/widgets/tutorials/addressbook/part1.py
index e26206d8f..648ddea46 100644
--- a/examples/widgets/tutorials/addressbook/part1.py
+++ b/examples/widgets/tutorials/addressbook/part1.py
@@ -5,9 +5,8 @@
import sys
from PySide6.QtCore import Qt
-from PySide6.QtWidgets import (QApplication, QGridLayout,
- QLabel, QGridLayout, QLineEdit, QTextEdit,
- QWidget)
+from PySide6.QtWidgets import (QApplication, QGridLayout, QLabel, QLineEdit,
+ QTextEdit, QWidget)
class AddressBook(QWidget):
diff --git a/examples/widgets/tutorials/addressbook/part2.py b/examples/widgets/tutorials/addressbook/part2.py
index 89c813006..3c0eb451d 100644
--- a/examples/widgets/tutorials/addressbook/part2.py
+++ b/examples/widgets/tutorials/addressbook/part2.py
@@ -102,17 +102,16 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
if not self.contacts:
diff --git a/examples/widgets/tutorials/addressbook/part3.py b/examples/widgets/tutorials/addressbook/part3.py
index 571a96a48..611796f5e 100644
--- a/examples/widgets/tutorials/addressbook/part3.py
+++ b/examples/widgets/tutorials/addressbook/part3.py
@@ -116,17 +116,16 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
if not self.contacts:
diff --git a/examples/widgets/tutorials/addressbook/part4.py b/examples/widgets/tutorials/addressbook/part4.py
index 505fe4db9..95f31d46c 100644
--- a/examples/widgets/tutorials/addressbook/part4.py
+++ b/examples/widgets/tutorials/addressbook/part4.py
@@ -128,34 +128,34 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if self._current_mode == self.AddingMode:
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._current_mode == self.EditingMode:
if self._old_name != name:
if name not in self.contacts:
QMessageBox.information(self, "Edit Successful",
- f'"{self.oldName}" has been edited in your address book.')
+ f'"{self.oldName}" has been edited in your '
+ 'address book.')
del self.contacts[self._old_name]
self.contacts[name] = address
else:
QMessageBox.information(self, "Edit Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._old_address != address:
QMessageBox.information(self, "Edit Successful",
- f'"{name}" has been edited in your address book.')
+ f'"{name}" has been edited in your address book.')
self.contacts[name] = address
self.update_interface(self.NavigationMode)
@@ -169,19 +169,18 @@ class AddressBook(QWidget):
@Slot()
def remove_contact(self):
name = self._name_line.text()
- address = self._address_text.toPlainText()
if name in self.contacts:
button = QMessageBox.question(self, "Confirm Remove",
- f'Are you sure you want to remove "{name}"?',
- QMessageBox.Yes | QMessageBox.No)
+ f'Are you sure you want to remove "{name}"?',
+ QMessageBox.Yes | QMessageBox.No)
if button == QMessageBox.Yes:
self.previous()
del self.contacts[name]
QMessageBox.information(self, "Remove Successful",
- f'"{name}" has been removed from your address book.')
+ f'"{name}" has been removed from your address book.')
self.update_interface(self.NavigationMode)
diff --git a/examples/widgets/tutorials/addressbook/part5.py b/examples/widgets/tutorials/addressbook/part5.py
index 72245703f..1e9c05862 100644
--- a/examples/widgets/tutorials/addressbook/part5.py
+++ b/examples/widgets/tutorials/addressbook/part5.py
@@ -134,34 +134,34 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if self._current_mode == self.AddingMode:
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._current_mode == self.EditingMode:
if self._old_name != name:
if name not in self.contacts:
QMessageBox.information(self, "Edit Successful",
- f'"{self.oldName}" has been edited in your address book.')
+ f'"{self.oldName}" has been edited in your '
+ 'address book.')
del self.contacts[self._old_name]
self.contacts[name] = address
else:
QMessageBox.information(self, "Edit Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._old_address != address:
QMessageBox.information(self, "Edit Successful",
- f'"{name}" has been edited in your address book.')
+ f'"{name}" has been edited in your address book.')
self.contacts[name] = address
self.update_interface(self.NavigationMode)
@@ -175,19 +175,18 @@ class AddressBook(QWidget):
@Slot()
def remove_contact(self):
name = self._name_line.text()
- address = self._address_text.toPlainText()
if name in self.contacts:
button = QMessageBox.question(self, "Confirm Remove",
- f'Are you sure you want to remove "{name}"?',
- QMessageBox.Yes | QMessageBox.No)
+ f'Are you sure you want to remove "{name}"?',
+ QMessageBox.Yes | QMessageBox.No)
if button == QMessageBox.Yes:
self.previous()
del self.contacts[name]
QMessageBox.information(self, "Remove Successful",
- f'"{name}" has been removed from your address book.')
+ f'"{name}" has been removed from your address book.')
self.update_interface(self.NavigationMode)
@@ -243,7 +242,7 @@ class AddressBook(QWidget):
self._address_text.setText(self.contacts[contact_name])
else:
QMessageBox.information(self, "Contact Not Found",
- f'Sorry, "{contact_name}" is not in your address book.')
+ f'Sorry, "{contact_name}" is not in your address book.')
return
self.update_interface(self.NavigationMode)
@@ -311,8 +310,7 @@ class FindDialog(QDialog):
text = self._line_edit.text()
if not text:
- QMessageBox.information(self, "Empty Field",
- "Please enter a name.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name.")
return
else:
self._find_text = text
diff --git a/examples/widgets/tutorials/addressbook/part6.py b/examples/widgets/tutorials/addressbook/part6.py
index f75fbf44f..d11298fb9 100644
--- a/examples/widgets/tutorials/addressbook/part6.py
+++ b/examples/widgets/tutorials/addressbook/part6.py
@@ -145,34 +145,34 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if self._current_mode == self.AddingMode:
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._current_mode == self.EditingMode:
if self._old_name != name:
if name not in self.contacts:
QMessageBox.information(self, "Edit Successful",
- f'"{self.oldName}" has been edited in your address book.')
+ f'"{self.oldName}" has been edited in your '
+ 'address book.')
del self.contacts[self._old_name]
self.contacts[name] = address
else:
QMessageBox.information(self, "Edit Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._old_address != address:
QMessageBox.information(self, "Edit Successful",
- f'"{name}" has been edited in your address book.')
+ f'"{name}" has been edited in your address book.')
self.contacts[name] = address
self.update_interface(self.NavigationMode)
@@ -186,19 +186,18 @@ class AddressBook(QWidget):
@Slot()
def remove_contact(self):
name = self._name_line.text()
- address = self._address_text.toPlainText()
if name in self.contacts:
button = QMessageBox.question(self, "Confirm Remove",
- f'Are you sure you want to remove "{name}"?',
- QMessageBox.Yes | QMessageBox.No)
+ f'Are you sure you want to remove "{name}"?',
+ QMessageBox.Yes | QMessageBox.No)
if button == QMessageBox.Yes:
self.previous()
del self.contacts[name]
QMessageBox.information(self, "Remove Successful",
- f'"{name}" has been removed from your address book.')
+ f'"{name}" has been removed from your address book.')
self.update_interface(self.NavigationMode)
@@ -254,7 +253,7 @@ class AddressBook(QWidget):
self._address_text.setText(self.contacts[contact_name])
else:
QMessageBox.information(self, "Contact Not Found",
- f'Sorry, "{contact_name}" is not in your address book.')
+ f'Sorry, "{contact_name}" is not in your address book.')
return
self.update_interface(self.NavigationMode)
@@ -304,8 +303,8 @@ class AddressBook(QWidget):
def save_to_file(self):
fileName, _ = QFileDialog.getSaveFileName(self,
- "Save Address Book", '',
- "Address Book (*.abk);;All Files (*)")
+ "Save Address Book", '',
+ "Address Book (*.abk);;All Files (*)")
if not fileName:
return
@@ -314,7 +313,7 @@ class AddressBook(QWidget):
out_file = open(str(fileName), 'wb')
except IOError:
QMessageBox.information(self, "Unable to open file",
- f'There was an error opening "{fileName}"')
+ f'There was an error opening "{fileName}"')
return
pickle.dump(self.contacts, out_file)
@@ -322,8 +321,8 @@ class AddressBook(QWidget):
def load_from_file(self):
fileName, _ = QFileDialog.getOpenFileName(self,
- "Open Address Book", '',
- "Address Book (*.abk);;All Files (*)")
+ "Open Address Book", '',
+ "Address Book (*.abk);;All Files (*)")
if not fileName:
return
@@ -332,7 +331,7 @@ class AddressBook(QWidget):
in_file = open(str(fileName), 'rb')
except IOError:
QMessageBox.information(self, "Unable to open file",
- f'There was an error opening "{fileName}"')
+ f'There was an error opening "{fileName}"')
return
self.contacts = pickle.load(in_file)
@@ -340,8 +339,7 @@ class AddressBook(QWidget):
if len(self.contacts) == 0:
QMessageBox.information(self, "No contacts in file",
- "The file you are attempting to open contains no "
- "contacts.")
+ "The file you are attempting to open contains no contacts.")
else:
for name, address in self.contacts:
self._name_line.setText(name)
@@ -375,8 +373,7 @@ class FindDialog(QDialog):
text = self._line_edit.text()
if not text:
- QMessageBox.information(self, "Empty Field",
- "Please enter a name.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name.")
return
self._find_text = text
diff --git a/examples/widgets/tutorials/addressbook/part7.py b/examples/widgets/tutorials/addressbook/part7.py
index 2f874f9bd..3829c003d 100644
--- a/examples/widgets/tutorials/addressbook/part7.py
+++ b/examples/widgets/tutorials/addressbook/part7.py
@@ -151,34 +151,34 @@ class AddressBook(QWidget):
address = self._address_text.toPlainText()
if name == "" or address == "":
- QMessageBox.information(self, "Empty Field",
- "Please enter a name and address.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name and address.")
return
if self._current_mode == self.AddingMode:
if name not in self.contacts:
self.contacts[name] = address
QMessageBox.information(self, "Add Successful",
- f'"{name}" has been added to your address book.')
+ f'"{name}" has been added to your address book.')
else:
QMessageBox.information(self, "Add Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._current_mode == self.EditingMode:
if self._old_name != name:
if name not in self.contacts:
QMessageBox.information(self, "Edit Successful",
- f'"{self.oldName}" has been edited in your address book.')
+ f'"{self.oldName}" has been edited in your '
+ 'address book.')
del self.contacts[self._old_name]
self.contacts[name] = address
else:
QMessageBox.information(self, "Edit Unsuccessful",
- f'Sorry, "{name}" is already in your address book.')
+ f'Sorry, "{name}" is already in your address book.')
return
elif self._old_address != address:
QMessageBox.information(self, "Edit Successful",
- f'"{name}" has been edited in your address book.')
+ f'"{name}" has been edited in your address book.')
self.contacts[name] = address
self.update_interface(self.NavigationMode)
@@ -192,19 +192,18 @@ class AddressBook(QWidget):
@Slot()
def remove_contact(self):
name = self._name_line.text()
- address = self._address_text.toPlainText()
if name in self.contacts:
button = QMessageBox.question(self, "Confirm Remove",
- f'Are you sure you want to remove "{name}"?',
- QMessageBox.Yes | QMessageBox.No)
+ f'Are you sure you want to remove "{name}"?',
+ QMessageBox.Yes | QMessageBox.No)
if button == QMessageBox.Yes:
self.previous()
del self.contacts[name]
QMessageBox.information(self, "Remove Successful",
- f'"{name}" has been removed from your address book.')
+ f'"{name}" has been removed from your address book.')
self.update_interface(self.NavigationMode)
@@ -260,7 +259,7 @@ class AddressBook(QWidget):
self._address_text.setText(self.contacts[contact_name])
else:
QMessageBox.information(self, "Contact Not Found",
- f'Sorry, "{contact_name}" is not in your address book.')
+ f'Sorry, "{contact_name}" is not in your address book.')
return
self.update_interface(self.NavigationMode)
@@ -313,8 +312,8 @@ class AddressBook(QWidget):
def save_to_file(self):
fileName, _ = QFileDialog.getSaveFileName(self,
- "Save Address Book", '',
- "Address Book (*.abk);;All Files (*)")
+ "Save Address Book", '',
+ "Address Book (*.abk);;All Files (*)")
if not fileName:
return
@@ -323,7 +322,7 @@ class AddressBook(QWidget):
out_file = open(str(fileName), 'wb')
except IOError:
QMessageBox.information(self, "Unable to open file",
- f'There was an error opening "{fileName}"')
+ f'There was an error opening "{fileName}"')
return
pickle.dump(self.contacts, out_file)
@@ -331,8 +330,8 @@ class AddressBook(QWidget):
def load_from_file(self):
fileName, _ = QFileDialog.getOpenFileName(self,
- "Open Address Book", '',
- "Address Book (*.abk);;All Files (*)")
+ "Open Address Book", '',
+ "Address Book (*.abk);;All Files (*)")
if not fileName:
return
@@ -341,7 +340,7 @@ class AddressBook(QWidget):
in_file = open(str(fileName), 'rb')
except IOError:
QMessageBox.information(self, "Unable to open file",
- f'There was an error opening "{fileName}"')
+ f'There was an error opening "{fileName}"')
return
self.contacts = pickle.load(in_file)
@@ -349,8 +348,7 @@ class AddressBook(QWidget):
if len(self.contacts) == 0:
QMessageBox.information(self, "No contacts in file",
- "The file you are attempting to open contains no "
- "contacts.")
+ "The file you are attempting to open contains no contacts.")
else:
for name, address in self.contacts:
self._name_line.setText(name)
@@ -372,7 +370,7 @@ class AddressBook(QWidget):
last_name = ''
file_name = QFileDialog.getSaveFileName(self, "Export Contact",
- '', "vCard Files (*.vcf);;All Files (*)")[0]
+ '', "vCard Files (*.vcf);;All Files (*)")[0]
if not file_name:
return
@@ -380,8 +378,7 @@ class AddressBook(QWidget):
out_file = QFile(file_name)
if not out_file.open(QIODevice.WriteOnly):
- QMessageBox.information(self, "Unable to open file",
- out_file.errorString())
+ QMessageBox.information(self, "Unable to open file", out_file.errorString())
return
out_s = QTextStream(out_file)
@@ -399,7 +396,7 @@ class AddressBook(QWidget):
out_s << 'END:VCARD' << '\n'
QMessageBox.information(self, "Export Successful",
- f'"{name}" has been exported as a vCard.')
+ f'"{name}" has been exported as a vCard.')
class FindDialog(QDialog):
@@ -427,8 +424,7 @@ class FindDialog(QDialog):
text = self._line_edit.text()
if not text:
- QMessageBox.information(self, "Empty Field",
- "Please enter a name.")
+ QMessageBox.information(self, "Empty Field", "Please enter a name.")
return
self._find_text = text
diff --git a/examples/widgets/tutorials/cannon/t10.py b/examples/widgets/tutorials/cannon/t10.py
index c9c3fa7f6..8649bb562 100644
--- a/examples/widgets/tutorials/cannon/t10.py
+++ b/examples/widgets/tutorials/cannon/t10.py
@@ -43,8 +43,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -113,7 +113,7 @@ class MyWidget(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange()
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t11.py b/examples/widgets/tutorials/cannon/t11.py
index 997eecbd1..fbfd2481d 100644
--- a/examples/widgets/tutorials/cannon/t11.py
+++ b/examples/widgets/tutorials/cannon/t11.py
@@ -45,8 +45,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -175,7 +175,7 @@ class MyWidget(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange()
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t12.py b/examples/widgets/tutorials/cannon/t12.py
index 8847b2208..749c24684 100644
--- a/examples/widgets/tutorials/cannon/t12.py
+++ b/examples/widgets/tutorials/cannon/t12.py
@@ -62,8 +62,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -226,7 +226,7 @@ class MyWidget(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange("ANGLE")
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t13.py b/examples/widgets/tutorials/cannon/t13.py
index 4eb45a374..f9a771d15 100644
--- a/examples/widgets/tutorials/cannon/t13.py
+++ b/examples/widgets/tutorials/cannon/t13.py
@@ -64,8 +64,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -259,7 +259,7 @@ class GameBoard(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange("ANGLE")
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t14.py b/examples/widgets/tutorials/cannon/t14.py
index e4f1c350d..3c94408f3 100644
--- a/examples/widgets/tutorials/cannon/t14.py
+++ b/examples/widgets/tutorials/cannon/t14.py
@@ -65,8 +65,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -174,7 +174,8 @@ class CannonField(QWidget):
self._auto_shoot_timer.stop()
self.hit.emit()
self.can_shoot.emit(True)
- elif shot_r.x() > self.width() or shot_r.y() > self.height() or shot_r.intersects(self.barrier_rect()):
+ elif (shot_r.x() > self.width() or shot_r.y() > self.height()
+ or shot_r.intersects(self.barrier_rect())):
self._auto_shoot_timer.stop()
self.missed.emit()
self.can_shoot.emit(True)
@@ -301,7 +302,7 @@ class GameBoard(QWidget):
quit = QPushButton("&Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange("ANGLE")
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t4.py b/examples/widgets/tutorials/cannon/t4.py
index ba0ebc41b..37a2dc9dd 100644
--- a/examples/widgets/tutorials/cannon/t4.py
+++ b/examples/widgets/tutorials/cannon/t4.py
@@ -20,7 +20,7 @@ class MyWidget(QWidget):
self.quit.setGeometry(62, 40, 75, 30)
self.quit.setFont(QFont("Times", 18, QFont.Bold))
- self.quit.clicked.connect(qApp.quit)
+ self.quit.clicked.connect(qApp.quit) # noqa: F821
if __name__ == '__main__':
diff --git a/examples/widgets/tutorials/cannon/t5.py b/examples/widgets/tutorials/cannon/t5.py
index 42faeed01..ed5d085f8 100644
--- a/examples/widgets/tutorials/cannon/t5.py
+++ b/examples/widgets/tutorials/cannon/t5.py
@@ -25,7 +25,7 @@ class MyWidget(QWidget):
slider.setRange(0, 99)
slider.setValue(0)
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
slider.valueChanged.connect(lcd.display)
layout = QVBoxLayout(self)
diff --git a/examples/widgets/tutorials/cannon/t6.py b/examples/widgets/tutorials/cannon/t6.py
index 1cc2906f2..ea2e044e6 100644
--- a/examples/widgets/tutorials/cannon/t6.py
+++ b/examples/widgets/tutorials/cannon/t6.py
@@ -33,7 +33,7 @@ class MyWidget(QWidget):
quit = QPushButton("Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
layout = QVBoxLayout(self)
layout.addWidget(quit)
diff --git a/examples/widgets/tutorials/cannon/t7.py b/examples/widgets/tutorials/cannon/t7.py
index 51128e6c7..1175107b8 100644
--- a/examples/widgets/tutorials/cannon/t7.py
+++ b/examples/widgets/tutorials/cannon/t7.py
@@ -46,7 +46,7 @@ class MyWidget(QWidget):
quit = QPushButton("Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
previous_range = None
diff --git a/examples/widgets/tutorials/cannon/t8.py b/examples/widgets/tutorials/cannon/t8.py
index b82e24a01..9bb5516b8 100644
--- a/examples/widgets/tutorials/cannon/t8.py
+++ b/examples/widgets/tutorials/cannon/t8.py
@@ -43,8 +43,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning("LCDRange.setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -88,7 +88,7 @@ class MyWidget(QWidget):
quit = QPushButton("Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange()
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/cannon/t9.py b/examples/widgets/tutorials/cannon/t9.py
index 297e98e50..7cdda4e7b 100644
--- a/examples/widgets/tutorials/cannon/t9.py
+++ b/examples/widgets/tutorials/cannon/t9.py
@@ -43,8 +43,8 @@ class LCDRange(QWidget):
def set_range(self, minValue, maxValue):
if minValue < 0 or maxValue > 99 or minValue > maxValue:
qWarning(f"LCDRange::setRange({minValue}, {maxValue})\n"
- "\tRange must be 0..99\n"
- "\tand minValue must not be greater than maxValue")
+ "\tRange must be 0..99\n"
+ "\tand minValue must not be greater than maxValue")
return
self.slider.setRange(minValue, maxValue)
@@ -94,7 +94,7 @@ class MyWidget(QWidget):
quit = QPushButton("Quit")
quit.setFont(QFont("Times", 18, QFont.Bold))
- quit.clicked.connect(qApp.quit)
+ quit.clicked.connect(qApp.quit) # noqa: F821
angle = LCDRange()
angle.set_range(5, 70)
diff --git a/examples/widgets/tutorials/modelview/2_formatting.py b/examples/widgets/tutorials/modelview/2_formatting.py
index 73c993e5f..f39ec462c 100644
--- a/examples/widgets/tutorials/modelview/2_formatting.py
+++ b/examples/widgets/tutorials/modelview/2_formatting.py
@@ -32,7 +32,7 @@ class MyModel(QAbstractTableModel):
return "<--left"
if row == 1 and col == 1:
return "right-->"
- return f"Row{row}, Column{col+1}"
+ return f"Row{row}, Column{col + 1}"
elif role == Qt.FontRole:
if row == 0 and col == 0: # change font only for cell(0,0)
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel.py b/examples/widgets/tutorials/modelview/3_changingmodel.py
index e277dd1e8..2148ec5d3 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel.py
+++ b/examples/widgets/tutorials/modelview/3_changingmodel.py
@@ -43,6 +43,7 @@ class MyModel(QAbstractTableModel):
self.dataChanged.emit(top_left, top_left, [Qt.DisplayRole])
#! [3]
+
if __name__ == '__main__':
app = QApplication(sys.argv)
table_view = QTableView()
diff --git a/examples/widgets/tutorials/modelview/6_treeview.py b/examples/widgets/tutorials/modelview/6_treeview.py
index 09300560c..cac3c6d53 100644
--- a/examples/widgets/tutorials/modelview/6_treeview.py
+++ b/examples/widgets/tutorials/modelview/6_treeview.py
@@ -8,6 +8,7 @@ from PySide6.QtWidgets import QApplication, QMainWindow, QTreeView
"""PySide6 port of the widgets/tutorials/modelview/6_treeview example from Qt v6.x"""
+
#! [1]
class MainWindow(QMainWindow):
def __init__(self, parent=None):
diff --git a/examples/widgets/tutorials/modelview/7_selections.py b/examples/widgets/tutorials/modelview/7_selections.py
index 6c519c865..c879d8f67 100644
--- a/examples/widgets/tutorials/modelview/7_selections.py
+++ b/examples/widgets/tutorials/modelview/7_selections.py
@@ -9,6 +9,7 @@ from PySide6.QtWidgets import QApplication, QMainWindow, QTreeView
"""PySide6 port of the widgets/tutorials/modelview/7_selections example from Qt v6.x"""
+
#! [1]
class MainWindow(QMainWindow):
def __init__(self, parent=None):
diff --git a/examples/widgets/widgets/charactermap/characterwidget.py b/examples/widgets/widgets/charactermap/characterwidget.py
index 1df2a3b74..0f01f9684 100644
--- a/examples/widgets/widgets/charactermap/characterwidget.py
+++ b/examples/widgets/widgets/charactermap/characterwidget.py
@@ -127,7 +127,7 @@ class CharacterWidget(QWidget):
self._square_size, self._square_size, QBrush(Qt.red))
text = chr(key)
- painter.drawText(column * self._square_size + (self._square_size / 2) -
- font_metrics.horizontalAdvance(text) / 2,
+ painter.drawText(column * self._square_size + (self._square_size / 2)
+ - font_metrics.horizontalAdvance(text) / 2,
row * self._square_size + 4 + font_metrics.ascent(),
text)
diff --git a/examples/widgets/widgets/charactermap/mainwindow.py b/examples/widgets/widgets/charactermap/mainwindow.py
index 5f0e2bce4..d79285def 100644
--- a/examples/widgets/widgets/charactermap/mainwindow.py
+++ b/examples/widgets/widgets/charactermap/mainwindow.py
@@ -30,7 +30,7 @@ class MainWindow(QMainWindow):
file_menu.addAction("Quit", self.close)
help_menu = self.menuBar().addMenu("Help")
help_menu.addAction("Show Font Info", self.show_info)
- help_menu.addAction("About &Qt", qApp.aboutQt)
+ help_menu.addAction("About &Qt", qApp.aboutQt) # noqa: F821
central_widget = QWidget()
diff --git a/examples/widgets/widgets/digitalclock/doc/digitalclock.rst b/examples/widgets/widgets/digitalclock/doc/digitalclock.rst
index ef800d9c0..d13275d24 100644
--- a/examples/widgets/widgets/digitalclock/doc/digitalclock.rst
+++ b/examples/widgets/widgets/digitalclock/doc/digitalclock.rst
@@ -1,6 +1,8 @@
Digital Clock Example
=====================
+.. tags:: Android
+
The Digital Clock example shows how to use QLCDNumber to display a number with
LCD-like digits.
diff --git a/examples/widgets/widgets/tetrix/tetrix.py b/examples/widgets/widgets/tetrix/tetrix.py
index 3accd557a..b5df2aa35 100644
--- a/examples/widgets/widgets/tetrix/tetrix.py
+++ b/examples/widgets/widgets/tetrix/tetrix.py
@@ -52,7 +52,7 @@ class TetrixWindow(QWidget):
start_button.clicked.connect(self.board.start)
pause_button.clicked.connect(self.board.pause)
- quit_button.clicked.connect(qApp.quit)
+ quit_button.clicked.connect(qApp.quit) # noqa: F821
self.board.score_changed.connect(score_lcd.display)
self.board.level_changed.connect(level_lcd.display)
self.board.lines_removed_changed.connect(lines_lcd.display)
@@ -134,11 +134,11 @@ class TetrixBoard(QFrame):
def sizeHint(self):
return QSize(TetrixBoard.board_width * 15 + self.frameWidth() * 2,
- TetrixBoard.board_height * 15 + self.frameWidth() * 2)
+ TetrixBoard.board_height * 15 + self.frameWidth() * 2)
def minimum_size_hint(self):
return QSize(TetrixBoard.board_width * 5 + self.frameWidth() * 2,
- TetrixBoard.board_height * 5 + self.frameWidth() * 2)
+ TetrixBoard.board_height * 5 + self.frameWidth() * 2)
@Slot()
def start(self):
@@ -190,16 +190,17 @@ class TetrixBoard(QFrame):
shape = self.shape_at(j, TetrixBoard.board_height - i - 1)
if shape != Piece.NoShape:
self.draw_square(painter,
- rect.left() + j * self.square_width(),
- board_top + i * self.square_height(), shape)
+ rect.left() + j * self.square_width(),
+ board_top + i * self.square_height(), shape)
if self._cur_piece.shape() != Piece.NoShape:
for i in range(4):
x = self._cur_x + self._cur_piece.x(i)
y = self._cur_y - self._cur_piece.y(i)
self.draw_square(painter, rect.left() + x * self.square_width(),
- board_top + (TetrixBoard.board_height - y - 1) * self.square_height(),
- self._cur_piece.shape())
+ board_top
+ + (TetrixBoard.board_height - y - 1) * self.square_height(),
+ self._cur_piece.shape())
def keyPressEvent(self, event):
if not self._is_started or self._is_paused or self._cur_piece.shape() == Piece.NoShape:
@@ -234,7 +235,8 @@ class TetrixBoard(QFrame):
super(TetrixBoard, self).timerEvent(event)
def clear_board(self):
- self.board = [Piece.NoShape for i in range(TetrixBoard.board_height * TetrixBoard.board_width)]
+ self.board = [
+ Piece.NoShape for _ in range(TetrixBoard.board_height * TetrixBoard.board_width)]
def drop_down(self):
drop_height = 0
@@ -283,7 +285,7 @@ class TetrixBoard(QFrame):
if line_is_full:
num_full_lines += 1
- for k in range(TetrixBoard.board_height - 1):
+ for k in range(i, TetrixBoard.board_height - 1):
for j in range(TetrixBoard.board_width):
self.set_shape_at(j, k, self.shape_at(j, k + 1))
@@ -328,7 +330,7 @@ class TetrixBoard(QFrame):
x = self._next_piece.x(i) - self._next_piece.min_x()
y = self._next_piece.y(i) - self._next_piece.min_y()
self.draw_square(painter, x * self.square_width(),
- y * self.square_height(), self._next_piece.shape())
+ y * self.square_height(), self._next_piece.shape())
self.nextPieceLabel.setPixmap(pixmap)
@@ -349,11 +351,10 @@ class TetrixBoard(QFrame):
def draw_square(self, painter, x, y, shape):
color_table = [0x000000, 0xCC6666, 0x66CC66, 0x6666CC,
- 0xCCCC66, 0xCC66CC, 0x66CCCC, 0xDAAA00]
+ 0xCCCC66, 0xCC66CC, 0x66CCCC, 0xDAAA00]
color = QColor(color_table[shape])
- painter.fillRect(x + 1, y + 1, self.square_width() - 2,
- self.square_height() - 2, color)
+ painter.fillRect(x + 1, y + 1, self.square_width() - 2, self.square_height() - 2, color)
painter.setPen(color.lighter())
painter.drawLine(x, y + self.square_height() - 1, x, y)
@@ -361,25 +362,25 @@ class TetrixBoard(QFrame):
painter.setPen(color.darker())
painter.drawLine(x + 1, y + self.square_height() - 1,
- x + self.square_width() - 1, y + self.square_height() - 1)
+ x + self.square_width() - 1, y + self.square_height() - 1)
painter.drawLine(x + self.square_width() - 1,
- y + self.square_height() - 1, x + self.square_width() - 1, y + 1)
+ y + self.square_height() - 1, x + self.square_width() - 1, y + 1)
class TetrixPiece(object):
coords_table = (
- ((0, 0), (0, 0), (0, 0), (0, 0)),
- ((0, -1), (0, 0), (-1, 0), (-1, 1)),
- ((0, -1), (0, 0), (1, 0), (1, 1)),
- ((0, -1), (0, 0), (0, 1), (0, 2)),
- ((-1, 0), (0, 0), (1, 0), (0, 1)),
- ((0, 0), (1, 0), (0, 1), (1, 1)),
- ((-1, -1), (0, -1), (0, 0), (0, 1)),
- ((1, -1), (0, -1), (0, 0), (0, 1))
+ ((0, 0), (0, 0), (0, 0), (0, 0)),
+ ((0, -1), (0, 0), (-1, 0), (-1, 1)),
+ ((0, -1), (0, 0), (1, 0), (1, 1)),
+ ((0, -1), (0, 0), (0, 1), (0, 2)),
+ ((-1, 0), (0, 0), (1, 0), (0, 1)),
+ ((0, 0), (1, 0), (0, 1), (1, 1)),
+ ((-1, -1), (0, -1), (0, 0), (0, 1)),
+ ((1, -1), (0, -1), (0, 0), (0, 1))
)
def __init__(self):
- self.coords = [[0,0] for _ in range(4)]
+ self.coords = [[0, 0] for _ in range(4)]
self._piece_shape = Piece.NoShape
self.set_shape(Piece.NoShape)
diff --git a/examples/widgets/widgetsgallery/main.py b/examples/widgets/widgetsgallery/main.py
index dadd1a91a..e40077a38 100644
--- a/examples/widgets/widgetsgallery/main.py
+++ b/examples/widgets/widgetsgallery/main.py
@@ -5,7 +5,6 @@
import sys
-from PySide6.QtCore import QCoreApplication, Qt
from PySide6.QtWidgets import QApplication
from widgetgallery import WidgetGallery
diff --git a/examples/widgets/widgetsgallery/widgetgallery.py b/examples/widgets/widgetsgallery/widgetgallery.py
index 6178ee0d7..d43ab26a5 100644
--- a/examples/widgets/widgetsgallery/widgetgallery.py
+++ b/examples/widgets/widgetsgallery/widgetgallery.py
@@ -3,13 +3,21 @@
import sys
-from PySide6.QtWidgets import *
+from PySide6.QtCore import (QDateTime, QDir, QLibraryInfo, QSysInfo, Qt,
+ QTimer, Slot, qVersion)
from PySide6.QtGui import (QCursor, QDesktopServices, QGuiApplication, QIcon,
QKeySequence, QShortcut, QStandardItem,
QStandardItemModel)
-from PySide6.QtCore import (QDateTime, QDir, QLibraryInfo,
- QSysInfo, QTimer, Qt, qVersion, Slot)
-
+from PySide6.QtWidgets import (QApplication, QCheckBox, QComboBox,
+ QCommandLinkButton, QDateTimeEdit, QDial,
+ QDialog, QDialogButtonBox, QFileSystemModel,
+ QGridLayout, QGroupBox, QHBoxLayout, QLabel,
+ QLineEdit, QListView, QMenu, QPlainTextEdit,
+ QProgressBar, QPushButton, QRadioButton,
+ QScrollBar, QSizePolicy, QSlider, QSpinBox,
+ QStyleFactory, QTableWidget, QTabWidget,
+ QTextBrowser, QTextEdit, QToolBox, QToolButton,
+ QTreeView, QVBoxLayout, QWidget)
POEM = """Twinkle, twinkle, little star,
How I wonder what you are.
@@ -156,8 +164,8 @@ class WidgetGallery(QDialog):
top_layout.addStretch(1)
top_layout.addWidget(disable_widgets_checkbox)
- dialog_buttonbox = QDialogButtonBox(QDialogButtonBox.Help |
- QDialogButtonBox.Close)
+ dialog_buttonbox = QDialogButtonBox(QDialogButtonBox.Help
+ | QDialogButtonBox.Close)
init_widget(dialog_buttonbox, "dialogButtonBox")
dialog_buttonbox.helpRequested.connect(launch_module_help)
dialog_buttonbox.rejected.connect(self.reject)