В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Let’s Conquer the Moon Together!🌕
Just landed on To The Moon!? Don’t worry - you’re joining at the perfect time as we kick off Season 3!
Here’s how it works:
💸 mine Space Bucks,
🚀 upgrade your ship,
👥 invite friends & recruit a stellar crew,
🌌 play Star Dust to gain even more SP,
🏆 set off to the moon and level up!
Every step you take brings you closer to token airdrop💸 after all 5 seasons. Focus on missions, levelling up, inviting referrals, and growing your space bucks balance. And for those of you who are starting out now, you’ve still got a shot at the airdrop by playing, conquering, and contributing to the mission.
Ready to explore? Your adventure awaits!
👉TO THE MOON APP👈
Website | Telegram Chat | X | Discord | Medium
#ToTheMoon#MoonPlay#ecosystem#blockchain#gamefi#web3#wenlisting#secondseason#communitymilestone#communityfirst#taptap#clicker#game
Shine Bright with Your Season 2 Badges and Win Big! 🪙
Season 2 was definitely one to remember: fierce competition, amazing Space Bucks balances, crazy level-ups 🆙, completed missions, and tons of new players joining To The Moon! via referral links 🤝. We've got plenty of reasons to celebrate!
Just like we did in July - share your Achievement Badge from Season 2 2️⃣, and you could win a prize equal to the Space Bucks balance on it!
Here's how to join in:
1️⃣ Follow the @moonplay_official group.
2️⃣Join our lively chat at @moonplay_chat.
3️⃣Drop a screenshot of your Season 2 Achievement Badge + use a hashtag #Season2 in the comments below this announcement.
⭐️To find your Season 2 Badge, just tap your profile in the top right and look under the Loot Capsules.
We'll pick 20 lucky winners in 24 hours, so keep your eyes peeled! Good luck, and may your Badge shine the brightest!
👉TO THE MOON APP👈
Website | Telegram Chat | X | Discord | Medium
#ToTheMoon#MoonPlay#ecosystem#blockchain#gamefi#web3#wenlisting#secondseason#communitymilestone#communityfirst#taptap#clicker#game