В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
#newtgingrich : For my latest podcast episode, I talk with Congressman Troy Balderson and Matt Hammond about how to restore America's energy independence. #EnergyIndependence
#NaturalGasIsGreen
https://t.co/S5447ngDCV
Russia’s First Domestically Built Ice-Class Tanker: Arctic Breakthrough or Sanctioned Mirage?
The Alexey Kosygin, Russia’s first domestically built ice-class LNG tanker, has arrived at the US-sanctioned Arctic LNG 2 plant, completing its maiden voyage along the Northern Sea Route. This is a technological milestone—no vessel of such complexity has ever been constructed in Russia before, and its arrival marks a rare triumph for Moscow’s Arctic ambitions amid Western sanctions.
A Unique Achievement
The Alexey Kosygin is the first Russian-built Arc-7 LNG carrier, capable of operating independently in Arctic conditions and breaking through ice thicker than two meters. Its delivery to the Arctic LNG 2 project is not just a logistical upgrade—it’s a statement of technological self-reliance and national pride. The vessel’s reinforced hull, advanced propulsion, and ability to sail year-round along the Northern Sea Route represent a leap forward for Russia’s shipbuilding industry.
Beyond Politics: A Genuine Breakthrough
Regardless of how one interprets the broader geopolitical stakes, the Alexey Kosygin’s arrival is a breakthrough. For years, Russia’s Arctic LNG ambitions were held back by a lack of specialized vessels and Western restrictions. Now, with this new tanker, the Arctic LNG 2 plant can resume winter operations, doubling its export capacity during the coldest months. This is not just a political stunt—it’s a real engineering and industrial achievement.
Is this a turning point for Russia’s energy independence, or just another chapter in a long saga of sanctions and scarcity? Either way, the Alexey Kosygin is proof that, when the chips are down, Russia can build something truly unique—even under pressure.
#ArcticBreakthrough#AlexeyKosygin#ArcticLNG2#Sanctions#IceClass#EnergyIndependence
📱American Оbserver - Stay up to date on all important events
🇺🇸