В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
@RusEmbMalta:
🇷🇺Commentary by the Russian Ambassador to Malta Andrey Lopukhov on the "Times of Malta" editorial “A Far More Complex Reality” (published on 29 September 2025 in Times of Malta).
🔗 Read in full here.
🔹 The Minsk Agreements were designed to resolve the issues of Russian-speakers through autonomy within Ukraine. Their failure resulted from Kiev and its Western guarantors refusing to implement them.
🔹 Russian-speaking citizens in Ukraine faced systemic pressure: language and media bans, party closures, and discrimination against the canonical Orthodox Church.
🔹 NATO’s eastward expansion was among the key drivers of the Ukranian crisis and a real strategic risk for Russia’s security.
🔹 Russia is a nation with immense strategic potential, a resilient economy, and a proven efficiency Army. Any plans to “defeat” it are doomed to fail.
🔹 Europe’s future lies either in continuing self-deception and escalation, or in recognizing reality and seeking a genuine balance of interests.
#UkrainianCrisis#RussiaMalta
@RusEmbMalta:
Interview with the Russian Ambassador to Malta Andrey Lopukhov by Shawn Borg.
🔗https://shorturl.at/msGWY
#russiamalta
#russiawest
#RussiaUkraine
@RusEmbMalta:
🇷🇺 Comment by the Russian Ambassador to Malta, Andrey Lopukhov on the article by Edward Zammit Lewis, Chairperson of the Foreign and European Affairs Parliamentary Standing Committee, Malta, published in Times of Malta.
Key points:
🔹 Any “tribunals” or “funds” without UN Security Council mandate are legally null and void.
🔹 Malta’s neutrality cannot mean one-sided support for Ukraine alone.
🔹 Root causes of the crisis: Kiev’s refusal to implement the Minsk agreements, discrimination of Russian speakers, and NATO’s expansionist course.
🔹 Ignoring Kiev’s violations is not neutrality, but bias.
🔹 Confiscation of Russian assets in Europe = violation of the principle of property inviolability.
🔹 History shows: pressure and force against Russia have never worked.
👉 Full text: read
#RussiaMalta#RussiaEU#UkraineCrisis#InternationalLaw