В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Shipping disruptions strand 8 million kg of #Kenyan tea in #Mombasa as #US-#Israel war with #Iran hits exports
Disruptions to global shipping routes linked to the ongoing war between the United States, Israel, and Iran have left nearly eight million kilograms of tea stranded in warehouses in Mombasa, threatening export earnings and farmer incomes, according to the East Africa Tea Traders Association.
George Omuga, managing director of the association that runs the Mombasa tea auction, told Reuters that losses have been accumulating at roughly $8 million per week since 01 March.
“The current conflict in the Middle East has had a direct impact, a negative impact on this auction,” Omuga said, noting that no tea shipments were currently leaving for Middle Eastern markets, which account for 20–25% of Kenya’s tea exports.
https://x.com/addisstandard/status/2039378986518626404?s=20
News: #Somaliland's #Israel deal could put #Berbera port at risk
#Somaliland says its recognition by Israel could be a boon for its Berbera port. But with missiles flying across the region, it could also be a target.
Berbera port on the Gulf of Aden has been transformed by the #UAE firm #DP_World over the past decade into a state-of-the-art facility on one of the world's busiest trade routes.
Berbera still handles far fewer containers than nearby #Djibouti or #Mombasa, but port traffic was up 30 percent from 2023 to 2025, and recent diplomatic moves could lead to much more.
A deal under negotiation with #Ethiopia, a landlocked neighbour with more than 130 million inhabitants, could see traffic rise by another 80 percent, said port authority director Ali Diriye Ahmed.
Ethiopia did not respond to queries on the subject.
But an alliance with Israel also brings risks, particularly as the US-Israeli attacks on Iran this weekend increase the threat of ........
Read more: https://addisstandard.com/?p=55487