В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Welcome, New Space Cadets! 💫
Since Monday, we've welcomed an incredible 600k new space cadetsto our mission! 🚀 With so many explorers joining, here's a quick reminder about the journey ahead.
Your ship and crew are built for one epic trip only. After each successful mission to the moon, you level up and need to construct a brand new spaceship🚀 and recruit a fresh crew to set off on your next journey.
🌌New Ship: Each mission gives you the opportunity to build even cooler, more powerful ships. Your level increases with every successful expedition, unlocking better designs and greater mining power.
🌌Fresh Crew: Invite new friends to join your adventures. Each new expedition requires a full crew, and more friends mean greater strength and success. No friends? No prob! Use special bots.
🌌Continuous Exploration: The adventure never ends! Keep exploring the cosmos, completing missions, and reaping stellar rewards.
🌌Balance Intact: Levelling up doesn’t reset your Space Bucks balance. You keep all your hard-earned Space Bucks as you progress.
ℹ️ For more info, check the mission manual here.
Every journey helps you level up, bringing you closer to mastering the cosmos. So gear up, build your fleet, and keep pushing the boundaries of space exploration: the end of season 1 & the first token airdrop are coming!🔔
👉Start your To The Moon adventure now!👈
Website | Telegram Chat | X | Discord | Medium
#ToTheMoon#MoonPlay#ecosystem#blockchain#gamefi#web3#wenlisting#squad#rank#communityfirst#taptap#clicker#game
Squad Multiplier: Earn More💰
If you haven’t joined a squad yet, you’re missing out on a fantastic way to turbocharge your 💸 earnings and complete expeditions faster.
Whether you team up with friends or join forces with other players, being in a squad is your ticket to higher earnings. Head to the Crew tab—> Squads👥, check out the top squads on the leaderboard, or create your own and invite others to join.
The higher your squad’s rank, the bigger the Space Bucks multiplier, up to a whopping 1.5x! After three days in a squad ⏰, you start benefiting from the squad’s multiplier. Your squad’s rank boosts your:
💸 Mining income
✅ Mission rewards
🌕 Expedition rewards
💫 Star Dust rewards
So, what are you waiting for? Team up, level up, and watch your earnings skyrocket. Who’s going to be the first Rank 3 Squad in the game? Let’s wait and see!
👉Start your To The Moon adventure now!👈
Website | Telegram Chat | X | Discord | Medium
#ToTheMoon#MoonPlay#ecosystem#blockchain#gamefi#web3#wenlisting#squad#rank#communityfirst#taptap#clicker#game
Can You Catch The LEPrechaun? 🍀
Hey Space Cadets!
We're excited to announce a fantastic new partnership with LEPrechaun🎩! This summer, LEPrechaun is bringing a bottomless pot of $LEP coins - and you've got a chance to join the gold rush. Join their pre-launch on Telegram now and secure an airdrop for early users!
But that's not all! LEPrechaun is also introducing 4 fresh missions✅ for you, our brave explorers. Head to the Missions tab and check them out to boost your progress in ToTheMoon! and start earning $CLOVER in LEPrechaun bot.
Don't miss out on this stellar opportunity!
👉Start your To The Moon adventure now!👈
Website | Telegram Chat | X | Discord | Medium
#ToTheMoon#MoonPlay#LEPrechaun#partnership#ecosystem#blockchain#gamefi#web3#wenlisting#squad#rank#communityfirst#taptap#clicker#game