В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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 Wait is Over — Hot Devil Slot is Here! 😈
Kick off our HOT Series with a spin that’s hotter than your ex and easily twice as fun. Ready to play with fire or just here to warm up? With classic gameplay turned up to inferno levels, every spin is destined to thrill.
Let the games begin! 🔥
🍒 IGNITE THE FUN: https://play.truelab.games/game/hot-devil-slot-v1/static/index.html
#HotDevilSlot#OUTNOW#igamingnews#TrueLab#TrueSlots#TrueGames
🔞 | Play Responsibly
Only one week left until HOT MONEY hits the scene on June 13th!
Classic fun meets new age looks in the second game of our Hot Series. It's going to be a hot blast from the past, but better. 🔥
Demo Dropped! Check it: https://truelab.games/games/hot-money-slot
#HotMoney#AlmostHere#iGamingNews#TrueGames#TrueSlots#TrueLab
🔥💸 Feeling Lucky? More like feeling HOT! 💸🔥
HOT MONEY SLOT, the second game in TrueLab’s Hot Series, is OUT NOW. We’ve taken those good old fire and fruit line 3x3 mechanics and turned up the heat with top-notch graphics and sound.
The Hot Series games are the perfect complement to any game portfolio. Do you prefer quick action with a classic vibe but can't get yourself to revisit the oldies? This one's for you. Let's go. 🎰
➡️ SPIN IT: https://bit.ly/Hot-Money-Demo
#HotMoneySlot#OutNow#HotSeries#iGamingNews#TrueLab#TrueGames#TrueSlots
🔞 | Play Responsibly
HOT DEVIL SLOT kicks off the TrueLab HOT SERIES, blending iconic fruit and fire elements with an eye-poppingly sexy modern twist. All the goodness from the classics, reinvented with modern graphics, variable lines to vary hit rate and volatility and a gamble feature to really up the ante on those fiery hot sessions.
🗓️ Debuting: May 8th. Time to rediscover that classic feeling.
🎰 Demo is comin' in HOT! Stay tuned!
#HotDevilSlot#ComingSoon#OnlineSlots#iGamingNews#NewSlots#TrueLab#TrueGames#TrueSlots