В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Robert Martin is sailing to Gaza aboard the ‘Handala’. He reminds us that breaking Israel’s illegal siege on Gaza is the most important and urgent act that needs to be undertaken today. For Robert, joining the flotilla is a statement to the Palestinian people that they have not been forgotten as they endure a genocide while under brutal occupation - in spite of the consenting and complicit silence of the media and political establishments.
For Robert, joining the flotilla is also a testament to posterity, and to future generations, that there were people who chose to act.
“The world has woken up. Things are changing and I cannot wait for the day that there is a free Palestine.”
Keep ‘Handala’ safe. End Israel’s Siege.
#FreedomFlotilla#BreakIsraelsSiege#BreakTheSiege#SailToGaza#WomenAgainstBlockade#Handala#SolidarityWithPalestine
At 70 years old, Vigdis Bjorvand from Norway is sailing to Gaza aboard 'Handala' to help break Israel's illegal siege - a journey she's been waiting for for years. A Palestine activist since 1978, Vigdis says she never wants her grandchild to say, “Grandma, you didn’t do anything.”
She first joined 'Handala' in 2023, which did not manage to sail to Gaza, and tried again with 'Conscience' earlier this year. Now, she’s back on board, determined to deliver aid, medicine and solidarity to Palestinians in Gaza.
As governments remain silent, Vigdis stands with the Palestinian people. Keep Vigdis safe. Keep 'Handala' safe. And help end Israel's illegal siege and genocide of Gaza.
#FreedomFlotilla#BreakIsraelsSiege#BreakTheSiege#SailToGaza#WomenAgainstBlockade#Handala#SolidarityWithPalestine
Drones are now regularly flying over the flotilla.
As Yasemin Acar, Steering Committee member of the Global Sumud Flotilla, explains: this surveillance is meant to intimidate and exhaust us. But it only underscores why our mission is urgent.
For Palestinians, drones are not just cameras. They are weapons of war, used daily to surveil, intimidate, and kill. The same technology that terrorizes Gaza is now policing the Mediterranean, turning the sea into a graveyard.
We will not turn back. We continue to Gaza because this is about justice, freedom, and life.
#BreakTheSiege
#FreePalestine
#SailToGaza
#GlobalMovementToGaza
#GlobalSumudFlotilla
As we enter the high-risk zone, follow our mission by tracking the flotilla live on our website.
#BreakTheSiege#FreePalestine#SailToGaza
#AllEyesOnGaza
#GlobalMovementToGaza#GlobalSumudFlotilla