В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Upgrade your skills for free:
🧑🎓Master Course : Making the Business Case for Sustainability
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓Teaching Methods, Teaching Quality & Teaching Delivery 3.0
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning
Upgrade your skills for free:
🧑🎓Master Course in Smart Cities, Urban Planning & Development
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning
Upgrade your skills for free:
🧑🎓Master Course in Corporate Social Responsibility (CSR)
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning
Upgrade your skills for free:
🧑🎓Master Course in Climate Change Impact on Business
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓Multigenerational Leadership & Reskilling Your Organization
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓Master Course in Project Management 2.0
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning
Upgrade your skills for free:
🧑🎓AI-Powered Change Management for Digital Transformation
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning
Upgrade your skills for free:
🧑🎓Curso Completo de Mikrotik. Configuraciones y mucha Práctica
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓Programador Java en 37 Días Con práctica de Entrevista y más
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓NumPy, SciPy, Matplotlib & Pandas A-Z: Machine Learning
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning
Upgrade your skills for free:
🧑🎓Carbon Capture (CCUS): Governance, Policy, & Social License
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓The Complete JavaScript Course: From Zero to Expert
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓Certificado Profissional em Liderança e Gestão
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning
Upgrade your skills for free:
🧑🎓Mastering Manus: AI Automation for Marketing & Content
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓AI for Business Analysts
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓Entrepreneurial Guide to AI Strategy
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning
Upgrade your skills for free:
🧑🎓Emotional Intelligence in Teams and Collaboration ( EQ )
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓Data Visualization: Advanced Storytelling for Sales Success
▪️▪️▪️▪️▪️▪️▪️▪️
🧑🎓AI-Driven Business Process Modeling
▪️▪️▪️▪️▪️▪️▪️▪️
⚠️ Limited time offers
🧑🎓🧑🎓🧑🎓
https://SkillDiscounts.com/
@SkillDiscounts
#Learning_for_free
#FreeCoupon
#FreeLearning