В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🔋 "Low-voltage Transmission + DePIN" aims to optimize and enhance the performance and security of low-voltage systems by incorporating decentralized infrastructure.
🔌 Low-voltage transmission, which uses low voltage and small currents to transmit signals and data, combined with DePIN's decentralized features, enables safer, more reliable, and efficient data transmission.
#CyberCharge will integrate hardware chargers using the Charge-to-Earn (C2E) model, allowing users to verify their identity while charging their devices, making data transmission more flexible and decentralized.
#Lowvoltage#DePIN
Like👍, Retweet🔵, Comment
Link to the Tweet!
⚡️#CyberCharge: Innovations in Low-Voltage Transmission
🔌 Our charger not only meets everyday charging needs but also integrates seamlessly with custom modular components for storage and computing.
These modular components are encrypted with our proprietary Cyber C1 AI chip, enhancing system security and reliability.
#LowVoltage#AI#Charger
Like👍, Retweet🔵, Comment
Link to the Tweet!
Elektr ta'minotining past bosimida ham texnikangizning uzluksiz ishlashini ta'minlaydi.
__________________
Обеспечит бесперебойную работу вашей техники даже в условиях пониженной подачи электроэнергии.
#Ishonchli#Barakali#Artel#Yangilik#Новинка#LowVoltage
🧐Did you know? "Low-voltage transmission" uses minimal voltage and small currents to safely transmit energy, commonly found in mobile devices and communication systems.
💡This principle is at the core of #CyberCharge, our innovative Web3 charger.
🔋By combining low-voltage technology with #DePIN and blockchain, we've created the world's first Charge-to-Earn (C2E) charger—secure, portable, and reliable.
#Lowvoltage#Web3#charger
Like👍, Retweet🔵, Comment
Link to the Tweet!