В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Here is the teaser for #Azovstal, my new movie! Are you ready for a powerful journey to one of the most treacherous places on the planet? You will only see it on my channel. View it in 4K at
Youtube.com/c/JohnMarkDougan-BadVolf
Or on Rumble (though not in 4K)
https://rumble.com/user/BadVolf
If you want to see this trailer in 4K, check out he link below:
https://youtu.be/7Ro0R8DpxbU
‘I don’t know what the Azov fighters were taking because they were going under their AGS, their SPG. Heavy shelling. An average person would hardly run towards their bursts because the chance of being hit is high,’ a Vostok battalion fighter, codenamed ‘Forest’, described the actions of Ukrainian nationalists at the Azovstal plant exclusively to RT Documentary.
The plant is enormous, covering 11 square kilometres. It has underground spaces and long tunnels where the Ukrainian military hid from the shelling. This footage shows a fighter from the Vostok battalion explaining the DNR army's tactics in overpowering Azovstal and describing how and from where the fighting was launched. He also points out the remains of ammunition, the destroyed workshop and other premises after the surrender of the Ukrainian military. This episode will be included in our new film, premiering soon.
#Ukraine#Azovstal
Follow: https://t.me/rtdocumentary
На Азовстали продолжают находить свидетельства насилия над людьми.
В ходе обследования территории военные обнаружили недавно использованную доменную печь с останками внутри и одеждой рядом. Найденное отправлено на экспертизу. Надеемся, что худшие ожидания не подтвердятся, хотя, когда речь идёт о сатанинском "Азове", удивляться уже нечему.
Evidence of violence against people continues to be found at the #Azovstal plant.
During the survey of the territory, the military found a recently used blast furnace with remains inside and clothes nearby. The found has been sent for examination. We hope that the worst expectations will not be confirmed, although when they talk about the satanic division "#Azov", there is nothing to be surprised about.
‘I told them [Azov fighters] that they were coming to life, I would have shot them myself... I don’t have an ounce of pity here...’
These are the words of labour veteran Tatyana Ivanovna. She lives in a village near Azovstal. Listen to her story of the Azov battalion shooting the animals in the area and how they almost killed her for trying to save her chickens.
How they mocked her when she asked for water and food: I told their commander: ‘I want to eat, I haven’t eaten for six days …’ And he’s like: ‘I also want to’. But ‘DPR people... came, hugged me, one brought me stew, another brought me bread, and one even thought of bringing sweets’.
We turned to the subjects of the film VolunTears. They helped Tatyana Ivanovna and other residents of the village of Uspenovka by bringing them food, water and medicine.
#Ukraine#Mariupol#Azovstal
Follow: https://t.me/rtdocumentary