В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Some see a structure. We see a symbol.
Some see concrete. We see the collective will of 150 million people.
Some see a river diverted. We see a destiny harnessed.
The Grand Ethiopian Renaissance Dam is not just about generating megawatts; it's about generating hope. It's about empowering a nation to write its own story of prosperity. It's about telling the world that our future is in our own hands, powered by our own resources.
This is the pride of Ethiopia. A new era of light, energy, and sovereignty.
#ItsMyDam#EthiopiaRising#GERD#NationalPride#Development#Africa
http://t.me/etbisahusen
🎙️WEEK 17 | LIVE DISCUSSION
⚔🛡My Generation & Adwa
Reflecting on the 130th Anniversary of the Victory of Adwa
In honor of the 130th Anniversary of the Victory of Adwa, celebrated on Yekatit 23, 2018 (E.C.), we invite you to a powerful and timely conversation on legacy, identity, and national consciousness.
Tonight, on the Ethiopia First Telegram Channel, we will discuss, reflect, and critically engage on what Adwa means for our generation — and why it still matters today.
Be part of this historic dialogue.
📅February 27, 2026
🕗8:00–10:00 PM (EST) | 2:00–4:00 PM (Ethiopia Time)
🎙️Host: Ethiopia First
🗣️Guest: Alexander Yohannes — Red Nile Media
🔗Join Live:https://t.me/+AAE_Pc8aWTczYTA0
—
#Adwa130#VictoryOfAdwa#AdwaAnniversary#MyGenerationAndAdwa
#EthiopiaFirst#RedNileMedia#EthiopianHistory#AfricanVictory
#PanAfricanLegacy#Yekatit23#EthiopianPride#AdwaSpirit#EthiopiaRising