В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
📰Nissan, Honda and Mitsubishi refused to collaborate into a single holding company
❌ The companies officially canceled the memorandum of merger signed in December 2024. Negotiations lasted several months, but the parties were unable to reach an agreement.
ℹ️ Honda had proposed creating a single holding company in which it would gain management control and appoint a CEO. Another option was to turn Nissan into its subsidiary. Both options Nissan found unacceptable. The companies will now continue to cooperate, but only in software and electric cars.
💰 The collaboration was supposed to help compete with Tesla and BYD. The potential holding company was valued at $50 billion.
@CarsNews
#holdings#Nissan#Honda#Mitsubishi
🚘Mitsubishi Motors to opt out of Honda-Nissan holding company
📰Mitsubishi Motors has finalized its decision not to participate in the management integration plan proposed by Honda and Nissan, citing fears of being marginalized, sources revealed on January 24.
🚘 Instead, Mitsubishi plans to remain under Nissan, its largest shareholder, while seeking ways to collaborate with both automakers.
ℹ️ Honda and Nissan are considering establishing a holding company in August 2026, with plans to delist and operate under a single umbrella. However, Mitsubishi intends to stay outside the holding company framework and maintain its position as a Nissan subsidiary, with Nissan holding just under 30% of Mitsubishi’s shares.
@CarsNews
#Mitsubishi#Nissan#Honda#holdings