В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Herzi Halevi's resignation as Chief of Staff of the Israeli Army triggered a wave of resignations within the military leadership, following the failures of October 7, 2023, during Operation "Noah's Flood" and the subsequent war and its aftermath.
#HerziHalevi#IsraeliArmy#Gaza#Israel
Israeli activists led by the radical bloc demonstrated in front of the Ministry of Defense building in the heart of Tel Aviv. While their soldiers entered the building, they denounced the ongoing Israeli war of extermination on the Gaza Strip. The protesters told the soldiers coming into work that whether they are pulling the trigger, pressing buttons or making coffee at an office, as long as they are wearing the uniform and serving the Israeli state, they are an accomplice in the mass murder, the torture, the suffering, and destruction of the lives of over two million people in Gaza.
#Israel#TelAviv#IsraeliArmy#GazaGenocide#Palestine
Even after killing them, the Israeli occupation forces torture Palestinian martyrs by crushing their bones in the Eastern Neighborhood of Jenin in the West Bank.
#Palestine#WestBank#Jenin#Israel#IsraeliArmy
As part of the initial retaliation to the Israeli assassination of senior leader Sayyid Fuad Shokor, Hezbollah decided to strike two strategic targets inside the Israeli depth.
#Hezbollah#Lebanon#SouthLebanon#IsraeliArmy#Israel#TelAviv
Although known for operating deep in its enemy’s territory while focusing on attacking and destroying specific targets and gathering accurate intelligence, the Maglan commando unit of the Israeli Army was ambushed by Hezbollah in South Lebanon. The trap was part of the underway confrontations while Israel is attempting to set a foot on Lebanon’s soil.
#SouthLebanon#Lebanon#Israel#IsraeliArmy#Maglan
The Israeli Ministry of Defense's Rehabilitation Department reveals a surge in soldiers receiving treatment since the #war began, far exceeding the injury figures previously reported by the #IsraeliArmy. What have #Hamas and #Hezbollah done to #IsraeliSoldiers ?
#Hezbollah Chief Sayyed Hassan #Nasrallah refuted Israeli claims about a preemptive strike ahead of “Operation Al-Arbaeen” in the #Israeli depth. He also set a condition of resuming the retaliation, which has to do with the enemy’s admitting of losses inflicted in first phase.
#Lebanon#SouthLebanon#IsraeliArmy
Members of the Mista'arvim unit of the Israeli Army disguise like Palestinians to gather intelligence and execute other missions. Every group is dissolved once its work is found out.
#IsraeliArmy#Israel#Gaza#GazaGenocide#Palestine#Mistaarvim
Lebanese #Hezbollah military media releases video showing bases targeted in #Israel part of the First Phase of its response to the assassination of senior commander Fuad Shukr and killing of several civilians in #Beirut's southern suburbs on July 31.
#Lebanon#SouthLebanon#Nasrallah#Gaza#Palestine#IsraeliArmy
#Hezbollah Chief Sayyed Hassan #Nasrallah announced targets behind “Operation Al-Arbaeen” on August 25, 2024 in the #Israeli depth, and unveiled important details about the qualitative operation that struck the #Mossad HQ in #TelAviv suburb.
#Lebanon#SouthLebanon#IsraeliArmy
#Hezbollah Chief Sayyed Hassan #Nasrallah announced targets behind “Operation Al-Arbaeen” on August 25, 2024 in the #Israeli depth, and unveiled important details about the qualitative operation that struck the #Mossad HQ in #TelAviv suburb.
#Lebanon#SouthLebanon#IsraeliArmy