В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
WARNING: GRAPHIC CONTENT: Car bomb in Yemen's Aden leaves fatalities
A car bomb targeting the governor's convoy shook Yemen's southern port city of Aden, killing several people
#News#Reuters#Yemen#CarBomb#Aden
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
#Yemen Agriculture ministry condemns #Eritrean & #Somali attacks on Yemeni Fishermen
The Agriculture, Fisheries and Water Resources Ministry strongly condemned the criminal attacks and repeated violations targeting Yemeni fishermen in the #Red_Sea and the Gulf of #Aden by the Eritrean authorities and the authorities of the Somali region, describing them as a blatant violation of international, humanitarian, and maritime laws, norms, and conventions.
In a statement received by the Yemeni News Agency (Saba), the Ministry explained that Eritrean forces carried out a direct armed attack using live ammunition against civilian Yemeni fishermen within the territorial waters of the Republic of Yemen in the Red Sea, resulting in deaths and injuries, as well as the detention of a number of fishermen who were forcibly taken away.
The Ministry considered these actions a dangerous escalation that threatens the safety, security of fishermen, targets their livelihoods and .....
https://saba.ye/en/news3639829.htm
#Somalia warns against any #Israeli base plans on #Somaliland
Somalia has warned that its territory cannot be used as a launching pad for military operations, after two media reports that said Israel is planning to establish a military base in the breakaway region of Somaliland, directly across the Gulf of #Aden from #Yemen.
“Somalia does not want to see its territory pulled into external confrontations or used in ways that could further destabilise an already sensitive region,” Ali Omar, Somalia’s state minister for foreign affairs, told Al Jazeera on Thursday.
The warning from #Mogadishu comes after #US outlet Bloomberg and Sweden’s public radio Ekot reported this week about Israeli plans for a military installation near the strategic port city of #Berbera on the Gulf of Aden.
The reports come as the US Israeli war on Iran edges towards its second week, with the Strait of Hormuz effectively closed......
https://www.aljazeera.com/news/2026/3/12/somalia-warns-against-any-israeli-base-plans-on-somaliland