В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
😁The 6 Most Essential Skills: Base Top By Dima Murovanni😁
➡️Are you ready to take your Brazilian Jiu-Jitsu to the next level? The 6 Most Essential Skills: Base Top by B Team’s head coach, Dima Murovanni, is the perfect roadmap to accelerate your growth on the mats.
➡️With years of experience coaching the world’s top grapplers, he’s distilled his insights into a series that answers the most common question he gets: How can I improve my BJJ fast?
$127😍$11.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#DimaMurovanni#Passing#NoGi#ADCC
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁P.E.D. Footlock system: Leg locks on Steroids by Dima Murovanni😁
➡️Unlock the full potential of your leg lock game with the P.E.D. Footlock System, a groundbreaking instructional by B-Team's own Dima Murovanni.
➡️Dima breaks down why the straight footlock should be the foundation of your leg lock system—showing how its mechanics, control positions, and finishing pathways translate into heel hooks, kneebars, inside sankaku, and more..
̶$̶1̶2̶7̶😍$14.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#DimaMurovanni#Leglocks#NoGi#BTeam
💁♀️Buy
💁♀️
😁The 6 Most Essential Skills: Connection Top By Dima Murovanni😁
➡️The latest installment in Dima Murovanni’s best-selling “6 Most Essential Skills” series dives deep into what many elite grapplers consider the cornerstone of effective guard passing: connection from the top.
➡️In "Connection – Top", Dima breaks down how to establish and maintain dynamic connection while staying mobile, heavy, and in complete control.
$127😍$11.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#DimaMurovanni#Control#NoGi#ADCC
💁♀️Buy
💁♀️