В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
MicroStrategy(@Strategy) bought another 1,895 $BTC($180.34M) at an average price of $95,167 last week.
#Strategy currently holds 555,450 $BTC($52.35B), with an average buying price of $68,550 and an unrealized profit of $14.28B.
#CryptoSignals#FuturesTrading#VIPGroup#BTC#Altcoins#CryptoProfit
🚀 Crypto Trader 'Maji' Increases Long Positions Amid Market Fluctuations
On April 11, 'Maji' continued to strategically increase long positions, according to BlockBeats. The total value of these positions has risen to $42.17 million, up from approximately $34 million the previous evening. These positions are reported to have a high safety margin, with liquidation prices significantly lower than current market values.
As of the latest update, 'Maji' holds detailed positions including a 25x leverage on Ethereum with 12,131.7179 ETH at a liquidation price of $2,090.95, a 40x leverage on Bitcoin with 180 BTC at a liquidation price of $62,529.3, and a 10x leverage on HYPE with 43,750 units.
Additionally, 'Maji' has achieved a total contract profit of $1.85 million over the past week, and has turned a monthly loss into a profit of $190,000.
#CryptoTrading#Maji#LongPositions#MarketFluctuations#Ethereum#Bitcoin#LeverageTrading#CryptoProfit#HYPE#ContractProfit#BTC#ETH
🔥@CryptoDailyPrice – Your shortcut to daily crypto power! 💰
Get live price updates, learn pro trading tricks, and discover zero-investment earning hacks that actually work. 🚀
Stay tuned — every post drops something crucial, profitable, and mind-opening for crypto lovers like you! ⚡
#CryptoDailyPrice#CryptoUpdates#CryptoEarnings#CryptoTrading#CryptoTips#LearnToTrade#ZeroInvestment#CryptoForBeginners#DailyCryptoNews#PassiveIncome#CryptoSignals#CryptoMarket#CryptoProfit#StayTuned#EarnWithCrypto