В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🎉 AIRDROP MADNESS STARTS THIS SATURDAY! 🎉
Hey NeuralHubs fam—ready to turn your invites into cold, hard cash? 💸
We’re kicking off Weekly & Monthly Referral Airdrops, and you don’t want to miss this. 🤑
🚀 Weekly Airdrop: $200 up for grabs!
🥇 1st Place: $100
🥈 2nd Place: $60
🥉 3rd Place: $40
💰 Monthly Airdrop: $1,000 prize pool!
🥇 1st Place: $500
🥈 2nd Place: $300
🥉 3rd Place: $200
🔗 How to earn:
✅ Share your referral link (get it from the bot)
✅ Every friend who joins = 1 referral
✅ Referrals count toward both weekly & monthly leaderboards
✅ Plus, you get 20,000 tokens for every referral!
💥 It all kicks off this Saturday—so get your links ready, rally your crew, and start climbing the leaderboard.
🏆 More friends = More tokens = More cash. Let’s gooo!
😈 Payment: Crypto
➖➖➖➖🔻
🤖 BOT: @Chatgpt_OfficialBOT
💎@Chatgpt_OfficialNews → Soon @NeuralHubsNews
#️⃣#NeuralHubAI#Airdrop#ReferralContest#CryptoRewards
➖➖➖➖🔺
📰 AI News Update: 🤖
In the world of artificial intelligence, researchers have made significant strides in natural language processing. A new model developed by a team at a leading university has surpassed previous benchmarks in understanding context and nuances in text. This advancement could revolutionize chatbots, translation services, and content analysis tools.
Moreover, a breakthrough in AI ethics has been achieved with the development of a framework that prioritizes fairness and transparency in machine learning algorithms. This approach aims to mitigate biases and discrimination, ensuring AI systems make ethical decisions in various applications.
On the business front, tech giants are investing heavily in AI-driven solutions to enhance customer experiences and streamline operations. Companies across industries are increasingly leveraging AI to drive innovation...
➖➖➖➖🔻
🤖 BOT: @Chatgpt_OfficialBOT
💎@Chatgpt_OfficialNews
#️⃣#NeuralHubAI#ReferralContest#EarnTokens#WeeklyAirdrop
➖➖➖➖🔺
🚀 Referral Contest Heating Up – $200 Weekly Prize!
The race is ON, and here are your current top referrers:
🥇Amir – 30 referrals
🥈Pixel Wiz* – 29 referrals
🥉Ref Champ* – 23 referrals
But it’s not over yet — you still have time to climb the leaderboard and win your share of the $200 prize this week!
⚡️Just invite your friends using your referral link
😵Every referral brings you closer to the top
🏆Top 3 win: $100 • $60 • $40
Let’s go! Start inviting now and grab that top spot! 📈
➖➖➖➖🔻
🤖 BOT: @Chatgpt_OfficialBOT
💎@Chatgpt_OfficialNews
#️⃣#NeuralHubAI#ReferralContest#EarnTokens#WeeklyAirdrop
➖➖➖➖🔺