В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🔥 Pikaio Airdrop
Pikaio aims to be the first launchpad on the #Bitlayer network.
👉https://pika.io/points/fS7uzk
(If there are items)
1️⃣Wallet example (Metamask,OKXv.b)
2️⃣Connect your Twitter account and do the Rt, Like task.
3️⃣Connect Telegram and join the telegram channel.
That's it, the current number of tasks.
📌 There will be special rewards for early events
1.Early Token Airdrops: Catch the moment to receive airdrops of upcoming ecosystem tokens!
🆕 BitLayer is now live on TokenPocket.
🟧BitLayer is the first Bitcoin security-equivalent Layer 2 based on the BitVM paradigm.
🚀How to create/import a #BitLayer wallet on #TokenPocket Mobile Wallet and Chrome Extension Wallet?
Guide👉https://help.tokenpocket.pro/en/wallet-operation/how-to-create-a-wallet/bitlayer
💙Download #TokenPocket, create your BitLayer Wallet, and stay tuned to the upcoming campaign! 🔥
👉https://tokenpocket.pro
👉https://extension.tokenpocket.pro
🎇Happy #TP6Anni!!
💙Join and win 50 BitlayerLabs Lucky Helmet NFT Whitelists Giveaway on Galxe!
👉https://app.galxe.com/quest/TokenPocket/GCddyth8TC
🟧Bitlayer Lucky Helmet is the official NFT launched by BitlayerLabs, a symbol of identity representing the contributions of builders in the Bitlayer community.
#TP6Anni#TokenPocket#Bitlayer
🏅 Predict & Earn 50K Points Daily! 💰
🏀 Premier League Week 1 Prediction: Who will win—Man United vs. Fulham, Arsenal vs. Wolves?
👉 How to Enter:
- RT & comment with a screenshot of your prediction
- Drop your Bitlayer address
🎯 5 winners will be randomly chosen to win 10K points each tomorrow!
Join Now: http://bitlayer.org/guess-to-earn
#Preditctowin#Bitlayer#Giveaway
Retweet:
https://x.com/bitlayerlabs/status/1824353973127745582?s=46
🟧 Enjoy the complete BitlayerLabs Ecosystem on your TokenPocket Wallet!
👉https://tokenpocket.pro
You can easily
✅Bridge #Bitcoin to Bitlayer
✅Find the trending DApps on Bitlayer
✅Track the real-time market #NFA
✅Manage your NFTs #LuckyHelmet
🔸and more in the near future!
Ready your #Bitlayer Wallet on TokenPocket and stay tuned for more!
👉https://help.tokenpocket.pro/en/wallet-operation/how-to-create-a-wallet/bitlayer