PyQt5升级PyQt6 笔记

QtCore.Qt.black ==> QtGui.QColor("black")

Qt.SolidLine ==> Qt.PenStyle.SolidLine

QtWidgets.QAction ==> QtGui.QAction

QtWidgets.QDesktopWidget().availableGeometry().center() ==> 
QtGui.QGuiApplication.primaryScreen().availableGeometry().center()

QtCore.Qt.Align ==> QtCore.Qt.AlignmentFlag.Align

QtCore.Qt.ScrollBarAlways ==> QtCore.Qt.ScrollBarPolicy.ScrollBarAlways

Qt.KeepAspectRatio ==> Qt.AspectRatioMode.KeepAspectRatio

Qt.FastTransformation ==> Qt.TransformationMode.FastTransformation

Qt.WA_TransparentForMouseEvents ==> Qt.WidgetAttribute.WA_TransparentForMouseEvents

Qt.FramelessWindowHint ==>
Qt.WindowType.FramelessWindowHint
...
Qt.WindowType.WindowStaysOnTopHint
Qt.WindowType.CoverWindow
QtCore.Qt.WindowType.Window
QtCore.Qt.WindowType.CustomizeWindowHint
QtCore.Qt.WindowType.WindowTitleHint
QtCore.Qt.WindowType.FramelessWindowHint
QtCore.Qt.WindowType.WindowTransparentForInput
QtCore.Qt.WindowType.WindowStaysOnTopHint
QtCore.Qt.WindowType.CoverWindow
QtCore.Qt.WindowType.NoDropShadowWindowHint
QtCore.Qt.WindowType.WindowDoesNotAcceptFocus

QtWidgets.QDesktopWidget().screenGeometry(-1) ==>
QtGui.QGuiApplication.primaryScreen().availableGeometry()

Qt.Checked ==>
Qt.CheckState.Checked
Qt.Unchecked ==>
Qt.CheckState.Unchecked

Qt.WA_TranslucentBackground ==>
Qt.WidgetAttribute.WA_TranslucentBackground

QSizePolicy.Fixed ==>
QSizePolicy.Policy.Fixed

Qt.TextSelectableByMouse ==>
Qt.TextInteractionFlag.TextSelectableByMouse

Qt.ClickFocus ==>
Qt.FocusPolicy.ClickFocus

QSizePolicy.Fixed ==>
QSizePolicy.Policy.Fixed

getattr(QtWidgets.QStyle, 'SP_DirLinkIcon') ==>
QtWidgets.QStyle.StandardPixmap.SP_DirLinkIcon

getattr(QtWidgets.QStyle, 'SP_DialogCloseButton') ==>
QtWidgets.QStyle.StandardPixmap.SP_DialogCloseButton

QtWidgets.qApp.quit ==>
QtWidgets.QApplication.instance().quit

app.exec_() ==>
app.exec()

loop.exec_() ==>
loop.exec()

PyQt6更改PySide6 笔记

QtCore.pyqtSignal ==>
QtCore.Signal

PyQt5升级PySide6 笔记

QtCore.pyqtSignal ==> QtCore.Signal

@QtCore.pyqtSlot() ==> @QtCore.Slot()

QtWidgets.QAction ==> QtGui.QAction

QtWidgets.QDesktopWidget().availableGeometry().center() ==> QtGui.QGuiApplication.primaryScreen().availableGeometry().center()

QtWidgets.qApp.quit ==> QtCore.QCoreApplication.instance().quit

app.exec()

PyQt5更改PySide2 笔记

QtCore.pyqtSignal ==>
QtCore.Signal

pyqtSlot ==> Slot

QtWidgets.qApp.quit ==>
QtWidgets.QApplication.instance().quit

pyside2: For the standard PySide2 incomplete workarounds are applied. For full support consider provided information.