В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль QtCompat (compatibility). Там не так много функций но они довольно полезны.
Этот модуль содержит унификаци модуля shiboken2, функций loadUi, translate и несколько переименованных функций классов или изменённую сигнатуру аргументов и возвращаемых значений. Это единственное исключение из правила когда вам потребуется где-то изменить свой код кроме импортов и этот код не похож на обычный код PySide2.
Например, в PyQt4 и PySide есть метод
QHeaderView.setResizeMode
Для PyQt5 и PySide2 они были благополучно переименованы в
QHeaderView.setSectionResizeMode
Чтобы применить этот метод следует использовать такой код
from Qt import QtCompath
header = self.horizontalHeader()
QtCompat.QHeaderView.setSectionResizeMode(header, QtWidgets.QHeaderView.Fixed)
Унификация загрузки UI файлов:
# PySide2
from PySide2.QtUiTools import QUiLoader
loader = QUiLoader()
widget = loader.load(ui_file)
# PyQt5
from PyQt5 import uic
widget = uic.loadUi(ui_file)
# Qt.py
from Qt import QtCompat
widget = QtCompat.loadUi(ui_file)
Хорошо что таких моментов не много и их легко запомнить.
Полный список можно посмотреть в таблице.
#qt#tricks
🏴Intensa jornada en el mercado de fichajes de la Premier League:
🇧🇪Sebastian Bornauw (26 años) ficha por el Leeds. El acuerdo con el Wolfsburg y los 'whites' se cierra por cerca de €6M.
🏴El delantero escocés Dan Cummings (19 años) es nuevo refuerzo del West Ham. Llega libre tras terminar contrato con el Celtic.
🇸🇳Habib Diarra (21 años) ficha por el Sunderland. Han pagado casi €32M por el mediocampista al Estrasburgo, lo que lo convierte en el fichaje más caro de la historia de los 'black cats'.
🇳🇱El delantero Zepiqueno Redmond (19 años) llega al Aston Villa como agente libre tras quedar desvinculado del Feyenoord.
@LaGuiadelFutbol | #PremierLeague
⚡️Fanton EN: Premier League Gameweek 35 Overview
#PremierLeague#fantasy
Fanton EN presents a preview of Premier League Gameweek 35, covering key matches like Leicester vs. Southampton, Chelsea vs. Liverpool, Brighton vs. Newcastle, and Crystal Palace vs. Nottingham Forest. Each game carries significant implications for fantasy lineups, with Liverpool, Newcastle, and Nottingham still battling for crucial spots.
Source: link
@tonlines
Manchester City es campeón por 4ta vez consecutiva en la Premier League, luego de vencer 3-1 al West Ham
@Fut_planet⚜️#PremierLeague🏴#City🏴
Title races are rarely decided by headlines alone.
Probability shifts long before the table confirms it.
#ManchesterCity#PremierLeague#EdgeMarket#PredictionMarkets
Después de una temporada dónde veíamos al Chelsea de mal en peor logró lo que se veía imposible
Venció 2-1 al Bournemouth, y con un golazo de Moisés Caicedo el conjunto londinense se clasificó a la próxima edición de la UEFA Europa League🟠
@Fut_planet⚜️#PremierLeague🏴#Chelsea🏴#UEL🟠
England Premier League🏴
2026-05-13 19:00 UTC
Manchester City vs. Crystal Palace
Predicted outcome: Manchester City✅
Predicted score: 3:1
Actual: Manchester City 3:0
#ManchesterCity#CrystalPalace
#Football#PremierLeague
England Premier League🏴
2026-04-20 19:00 UTC
Crystal Palace vs. West Ham
Predicted outcome: Draw✅
Predicted score: 1:1
Actual: Draw 0:0
#CrystalPalace#WestHam
#Football#PremierLeague
England Premier League🏴
2026-05-11 19:00 UTC
Tottenham vs. Leeds
Predicted outcome: Leeds❌
Predicted score: 1:2
Actual: Draw 1:1
#Tottenham#Leeds
#Football#PremierLeague
England Premier League🏴
2026-05-01 19:00 UTC
Leeds vs. Burnley
Predicted outcome: Leeds✅
Predicted score: 2:1
Actual: Leeds 3:1
#Leeds#Burnley
#Football#PremierLeague