В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🚨*ATTENTION*
*The British chapter of the Antifascist International* calls on the oppressed of the world to stand firmly with Venezuelan 🇻🇪 sovereignty and to denounce *UK complicity* in the imperialist war against *Venezuela*.
All out! Join us!
🗓 10 January ⏰ 1:00pm
🏢 Downing Street
🥁 Bring noise, flags, banners!!
#HandsOffVenezuela
https://antifascistinternational.uk/solidarity-with-the-people-of-the-bolivarian-republic-of-venezuela-and-president-nicolas-maduro-moros/
Erklärung der DKP zu den US-Angriffen gegen Venezuela!
Jetzt lesen unter unsere-zeit.de/haende-weg-von-venezuela-3-4810421/
#handsoffvenezuela#venezuela#usa
Responding to a call from the International People's Assembly, ALBA Movimientos, The Simon Bolivar Institute and The Assembly of Caribbean Peoples, activists worldwide rallied against US intervention in Venezuela and supported its recent presidential election.
From Kinshasa to Seoul, Rome to Luanda, and beyond, demonstrations defended Venezuelan democracy and sovereignty. In cities like Oslo, Vigo, and Pretoria, participants voiced solidarity with the Venezuelan people and the Bolivarian Government and condemned fascism and imperialist actions.
Click here to view the full gallery 👉🏼https://shorturl.at/YV7b0
#handsoffVenezuela#Venezuela#solidarity#internationalpeoplesassembly
🇺🇸🕊️El imperio no habla por su pueblo
⚡️Mientras Trump escala su agresión contra Venezuela, crece la resistencia interna en Estados Unidos. Organizaciones pacifistas protestaron frente al Congreso para denunciar la larga historia de intervenciones ilegales impulsadas desde la Casa Blanca.
📄 Respaldados por más de 15.000firmas, los activistas exigieron apoyo a la Resolución Constitucional 68, que ordena retirar a las Fuerzas Armadas de EE.UU. de Venezuela por carecer de aval legislativo.
👉 Incluso dentro de EE.UU., la guerra pierde legitimidad.
#NoALaGuerra
#TrumpAgresor
#VenezuelaResiste
#PuebloDeEEUUContraLaGuerra
#NoMásIntervenciones
#RespetoAlDerechoInternacional
#AntiImperialismo
#PeaceNotWar
#HandsOffVenezuela