В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Audi has officially unveiled the new generation A6!
Now, this index belongs to electric vehicles — a liftback and an estate version.
🚘 The exterior of the new models is almost entirely copied from the namesake concepts, while the interior is inspired by the Q6 e-tron crossover.
🚢 The base version will be the rear-wheel drive A6 e-tron performance with a single motor producing 367 hp. For the S6, there will be two motors delivering 550 hp and accelerating from 0 to 100 km/h in just 3.9 seconds, with a top speed of 240 km/h.
🔋 In both cases, a 100 kWh battery is provided, allowing the single-motor versions to travel up to 756 km, while the all-wheel drive versions can reach up to 675 km.
ℹ️ Pre-orders will start in September, with prices starting at €75,600 for the standard version and €99,500 for the S6.
#Audi#A6#ElectricVehicles#ETRON#CarLaunch#LuxuryCars#Innovation#S6#Auto
🚗✨Introducing the Audi Q6 e-tron Sportback!✨🚗
The sleek new Sportback version features a more aerodynamic design, reducing the drag coefficient from 0.28 to 0.26! 🌬️ This enhancement boosts the range to an impressive 656 km on a single charge! 🔋💨
🔧Powertrain Options:
• Rear-wheel drive versions come with a single electric motor delivering 252 or 306 hp paired with 83 or 100 kWh batteries. ⚡️
• The all-wheel drive variant boasts 387 hp, accelerating from 0 to 100 km/h in just 5.9 seconds! 🚀
• The top-tier SQ6 Sportback e-tron unleashes an incredible 489 hp, hitting 100 km/h in only 4.3 seconds! 🏁🔥
🏭 Production is set at the Ingolstadt plant, with prices starting at €65,900 and going up to €96,200. 💰
#AudiQ6#eTron#Sportback#ElectricVehicle#EV#SustainableDriving#LuxuryCars#Innovation#AudiFamily#Auto🚘🌍