Porting Applications from PySide2 to PySide6¶
Qt for Python 6.0.0 initially ships with the essential Modules and some add-ons (Qt 3D, Qt Concurrent, Qt Help, Qt OpenGL, Qt Print Support Qt Quick Widgets, Qt SQL, Qt SVG, Qt UI Tools and Qt XML).
More modules will follow in subsequent releases as they are added to Qt.
For Qt for Python 6.1, Active Qt, Qt Charts, Qt Data Visualization, Qt StateMachine and Qt SCXML are planned.
Qt Quick Controls 1 have been removed.
QStateMachineand related classes have been extracted to a new QtStateMachine module.
QXmlReaderand related classes (SAX API) have been removed.
The content of the QtOpenGL module has been replaced. The class
QGLWidgetand related classes (
QGLShaderProgram) have been removed. Parts of the Open GL functionality from QtGui have been extracted into this module, for example
QOpenGLShaderProgram. There is a new module QtOpenGLWidgets which contains the class
QOpenGLWidget, a replacement for
As Open GL is phasing out, QRhi should be considered for graphics applications.
The first thing to do when porting applications is to replace the import statements:
from PySide2.QtWidgets import QApplication... from PySide2 import QtCore
needs to be changed to:
from PySide6.QtWidgets import QApplication... from PySide6 import QtCore
Some classes are in a different module now, for example
QShortcut have been moved from
For Qt Charts and Qt Data Visualization, the additional namespaces have been removed. It is now possible to use:
from PySide6.QtCharts import QChartView
Then, the code base needs to be checked for usage of deprecated API and adapted accordingly. For example:
The High DPI scaling attributes
Qt.AA_UseHighDpiPixmapsare deprecated. High DPI is by default enabled in Qt 6 and cannot be turned off.
QDesktopWidgethas been removed.
QScreenshould be used instead, which can be retrieved using
QFontMetrics.width()has been renamed to
QPointas well as
intare now deprecated.
QPointFshould be used instead.
Qt.MidButtonhas been renamed to
QOpenGLContext.versionFunctions()should be used to obtain Open GL functions.
QRegExphas been replaced by
QWidget.mapFromGlobal()now also accept and return
QEventLoop) have been renamed to
execwhich became possible in Python 3.
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.