В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
The would-be #assassin of #Slovakian PM Robert #Fico has been identified as 71 year old Juraj #Cintula
He is alleged to be a supporter of the "#ProgressiveSlovakia" (PS) political party.
PS is pro-: neoliberalism, Eurocentrism, rearmament, #Russia sanctions and open borders.
Basically your average treacherous European-centrist party.
The 1st video above is from 2016, when Cintula was working for the security company #SBS and was briefly in the press because he had overpowered a rioter.
The 2nd video seems to have been taken today, 15th of May 2024, shortly after he was apprehended by Slovakian #Police, and appears to be videoed in either a Hospital or in a Police Station
Cintula is explaining his motives for shooting Fico
#Slovakian prime minister Robert #Fico shot and rushed to hospital after ‘attempted assassination’
Fico was shot in the town of #Handlova with a man detained at the scene
•In 2022 and 2023, Fico was a loud critic of the #VonderLeyen Commission and her foreign and #military policies in relation to #Russian invasion of #Ukraine.
He also expressed disagreements with the Commission in questions of #immigration.
•In December 2023, Fico criticized the "hypocrisy" of the EU, which was reluctant to talk about #Israeli#WarCrimes in #Gaza
•In 2023, Fico said #Ukraine's #Azov Battalion was "clearly a #fascist regiment".
•During a rally on 30 August, he also said that the War in Donbas started in 2014 when "Ukrainian #Nazis and fascists started murdering the Russian population of #Donbas"