В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🇾🇪🇾🇪Aerial View | Flood of Gratitude and Covenant
Driven by the resolve of "Do not weaken," the certainty of "You are the superior," the vigor of "Go forth," and the might of "Strike them above the necks"
🚩The million-man march: "In Gratitude to Allah and Celebration of Victory.. Our Squares are United Against Zionism."
Location: Al-Sabeen Square, the Capital #Sanaa
Date: 22 Shawwal 1447 | April 10, 2026
🚨@MideastPress✅
The new Esselunga campus for employees.
Esselunga entrusts the Japanese architects of Sanaa with the creation of a new campus in the historic headquarters of Pioltello, redeveloping an abandoned area to create a 10 thousand square meter park, a kindergarten, a gym, a multipurpose center, a medical office and a historical archive.
Architecture: Sanaa
Location: Italy
#arch_shovel#news#architecture#sanaa#italy
#Breaking: Six American and British terrorist airstrikes targeted several areas in the north and south of #Yemen's capital, #Sanaa.
Do NOT ask why you are hated across the world when YOUR tax money is dropped from #B2Spirit bombers on people's heads in #Yemen
What do they tell you when you ask them "WHY ARE YOU BOMBING PEOPLE HALF WAY ACROSS THE WORLD?"
I bet your leaders tell you they are "barbaric terrorists" exactly when you are playing on your smart phone the video of the burning tents in #Gaza at the hands of THE MOST BARBARIC terrorists to have ever roamed this earth..your Zionist Friends.
Yemeni Media reported that approximately 40 U.S. airstrikes targeting the capital, #Sanaa, as well as Saada and Al-Bayda, have resulted in an initial toll of 32 dead and over 100 wounded, the majority of whom are women and children. The strikes are expected to continue for weeks.
Four airstrikes hit the Al-Jeraf neighborhood in northern Sanaa, killing ten people and injuring 13 others. Additional strikes targeted the Attan and Jarban areas in the Sanhan district of Sanaa province.
In #Saada, reports indicate that airstrikes on two homes in the Qahza area, north of the city, led to a rising casualty count of ten dead and 13 wounded.
Meanwhile, the U.S. Central Command (#CENTCOM) confirmed that it had carried out a series of airstrikes against "Ansarullah" targets across #Yemen. CENTCOM stated that the operations involved precision strikes, justifying them as measures to defend U.S. interests, deter adversaries, and restore freedom of maritime navigation.
#RedSea#DonaldTrump