В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
BREAKING ⚠️🚨
⛴️⛴️⛴️ After months of failed negotiations, the @gazafreedomflotilla campaign in Turkiye @mavimarmaratr started the #FreedomWatch , a non-violent direct action with hundreds of people to free our boats from Hyadarpasa port in Istambul. The demonstrators blocked the port entrance and peacefully chained themselves to the gates.
🚨 LIVE NOW: https://www.instagram.com/mavimarmaratr?igsh=emNib2ZtZHFjZTFj
🇵🇸🍉 The objective of this inspiring action is that the we can finally sail to #Gaza to take desperately needed humanitarian aid and break the genocidal siege that Israel established on Gaza since 2007.
⛴️ Our protests in Turkiye will continue until our boats are free to sail, since they have all the necessary documentation and meet all the necessary requirements to do so. Please help us share this important action to #BreakTheSiege and to create a people´s humanitarian corridor in Gaza. When governments fail, we sail! #FreedomFlotilla#WeWillSail#LetThemSail🇵🇸
After prolonged negotiations with the Dutch Port Authority, ‘Handala’ is finally docked in Rotterdam! The Freedom Flotilla Coalition had organized a place to dock with Rotterdan City Marina but for undisclosed reasons, were prevented from docking in the planned location. This delay impacted our peaceful event and demonstration to welcome ‘Handala’ where children had drawn pictures and letters of support to send to Palestinian people in Gaza.
John Turnbull, representative of Canada Boat to Gaza, said “while engaging on this mission, the Palestinians are teaching us how to resist”.
Handala will continue to challenge the complicity of European countries on a journey to break the siege of Gaza. Next stop, London!
#breakthesiege#endtheblockade#gaza#palestine#freegaza#freepalestine#weaillsail#letthemsail#handala
Robert has long fought alongside Palestinians and isn't stopping now. Having spent time in Palestine documenting horrific human rights abuses by Israeli forces, he has seen the brutality of the occupation first hand. Despite the extreme difficulty in leaving his children and partner back home in what he describes as a "grieving process", he shares how important it is to use his privilege to be a part of the collective effort to break the siege on Gaza. As we have witnessed over the course of 9 months and 76+ years prior, we cannot fathom or predict the IOF's brutality or what they are capable of if they intercept 'Handala' in international waters. So we need your help in keeping Robert as safe as possible. We need your help in demanding safe passage for all volunteers onboard our Flotillas. Please share our videos, tag your politicians and ensure that we reach Gaza safely. #endtheblockade#breakthesiege#robertmartin#freepalestine#freegaza#endtheoccupation#solidarity#wewillsail#letthemsail
Palestinians in Gaza are being forced to endure a “vicious cycle of malnutrition, infection, wounds breaking down, more infection, more malnutrition”, explains British surgeon haunted by Gaza horrors. Professor Nick Maynard has only just arrived back in the UK after lending his expertise in Gaza where he witnessed teenagers with treatable, survivable injuries, whose bodies tragically shut down due to malnutrition. We need to break the siege of Gaza. We need to ensure the borders are opened to be able to provide medical aid and food to these teenagers and their families immediately. This could not be more urgent. #BreakTheSiege#AllEyesOnRafah#EndTheBlockade#GazaBlockade#FreedomFlotilla#WeWillSail#LetThemSail#Rafah#NickMaynard
The demonstration to release our Flotilla ships currently being prevented from leaving port by the Turkish Port Authorities, continues in Istanbul. We need your help in getting international media to cover this historic protest and help put pressure on the government to release our ships, ensuring we can sail towards Gaza.
HOW TO HELP:
1. Call, email and/or demonstrate at Turkish embassies and consulates and demand that the Freedom Flotilla ships be released and allowed to deliver aid to Gaza immediately.
2. Tag mainstream accounts in this post or when you share our photos to your stories.
3. Message the social media page of the Ministry of Transport and Foreign Affairs @tcdisisleri and @uabakanligi on IG and on X
4. Share our videos using the hashtags #WeWillSail and #LetThemSail tagging @tcdisisleri and @uabakanligi
#WeWillSail#LetThemSail#TheFreedomFlotilla#FFC#Istanbul#Turkiye#Turkey#MaviMarmara