В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Ладно, уже только за это взаимодействие можно порекомендовать сообщество дизайнеров Ньюс в телеграме, которое организовал Женя Арутюнов с командой
Продающий лендос с манифестом и промокодами тут
Если что, это ребята, которые когда-то для Додо придумывали смищные фразочки и другие оч человечные взаимодейтсвия)
🎤Ссылки на утро — второй канал
⏲Устойчивый VPN за звезду
#interaction@cogload#copywriting@cogload
🪐 The galaxy Arp 273, located about 300 million light-years away in the constellation Andromeda, is an extraordinary pair of interacting galaxies twisted into a shape that looks like a cosmic rose. One galaxy’s gravity is pulling and warping the other’s spiral arms, creating elegant loops and arcs that reveal the dramatic effects of galactic encounters in deep space. ✨
#galaxies⚡#interaction⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🌍 The geographic shell of the Earth is where the land, water, air, and life all meet and interact. This thin, dynamic layer makes our planet uniquely suited for life to thrive. ✨
#geography⚡#earthshell⚡#interaction⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
🌍 In Japan, centuries-old forest areas called satoyama are shaped by human care for farming, wood, and water, blending wild nature and villages into landscapes rich in biodiversity and tradition. ✨
#interaction⚡#landscapes⚡#biodiversity⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 In Indonesia, ancient forests and rice terraces share land with villages, blending wild and human-shaped environments. This mix supports rare wildlife while feeding local communities. ✨
#interaction⚡#landscapes⚡#sustainability⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels
🌍 In the Swiss Alps, ancient irrigation channels called "bisses" direct mountain water through villages and fields. These hand-built waterways have shaped both local ecosystems and farming for centuries. ✨
#interaction⚡#society⚡#mountains⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels