В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
It's Mid-week!
We hope you're not relenting in your pursuit of success? Keep grinding and keep your eyes laser focused on your goals.
As you continue in the week, avoid distractions and only spend time doing things that add value to you.
Brace up, the week hasn't ended yet!
For Question, Information,Feedback ...
Kindly Contact
☎️T.me/FrxMaster_Gold
#PremiumVIP💯
#PropFirmChallenge&Verification✅
#FUNDEDAccountManagement👨🏻💻
JUST IN FOR VERIFICATION CHALLENGE ‼️
• Prop Firm - FTMO
• Challenge level - Phase 2
• Starting Balance - ($10,000)
• Current Balance - ($10,506.46)
• Target Profit - ($500 Growth)
• Profit - ($513.35)
• Floating Profits - ($0)
• Drawdown 3.47%
• Trading Period - (3 Days)
Interested Investors Should Share with us;
Platform:
Account ID:
Password:
Server Name:
Sign In Your Account Today For NEXT WEEK Trading.
Take a leap of faith and see your account grow consistently with us...Trust in our expertise. You surely won't be disappointed 👌
For Question, Information,Feedback ...
Kindly Contact
☎️T.me/FrxMaster_Gold
#PremiumVIP💯
#PropFirmChallenge&Verification✅
#FUNDEDAccountManagement👨🏻💻
JUST IN FOR VERIFICATION CHALLENGE ‼️
• Prop Firm - FTMO
• Challenge level - Phase 1
• Starting Balance - ($10,000)
• Current Balance - ($10,594.64)
• Target Profit - ($1k Growth)
• Profit - ($594.64)
• Floating Profits - ($78.7)
• Drawdown 0.47%
• Trading Period - (2 Days)
Interested Investors Should Share with us;
Platform:
Account ID:
Password:
Server Name:
Sign In Your Account Today For THIS WEEK Trading.
Take a leap of faith and see your account grow consistently with us...Trust in our expertise. You surely won't be disappointed 👌
For Question, Information,Feedback ...
Kindly Contact
☎️T.me/FrxMaster_Gold
#PremiumVIP💯
#PropFirmChallenge&Verification✅
#FUNDEDAccountManagement👨🏻💻