В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
News: At last day of its mandate, #Tigray interim administration president meets #PM_Abiy to present annual report
On the last day of its mandate, President of the Tigray Interim Administration, Lt. Gen. #Tadesse Worede, met Prime Minister Abiy Ahmed this morning to present his annual report, according to a brief statement from the Prime Minister’s Office.
The statement shared by the PM Office said the meeting focused on receiving the report and discussing its findings, but did not disclose details of the content or outcomes of the discussion.
The meeting comes exactly one year after Lt. Gen. Tadesse was appointed on April 8, 2025, to lead the interim administration in the Tigray Region, replacing Getachew Reda. Prior to his appointment, Tadesse served as deputy president of the interim administration and head of its cabinet secretariat for peace and security.........
https://www.facebook.com/AddisstandardEng/posts/pfbid026T2zp6KVZ5rdVCzYZ2etaSMRY3C9WWRNS9efDwjLTJFpQoVASVTBXr7Xn4nfbWudl
#Ethiopia: Preparedness is vital’: #Tigray President warns against ‘living in defeat’ at Emperor Yohannes IV commemoration
During the 137th anniversary of the martyrdom of #Emperor_Yohannes IV, Lieutenant General #Tadesse Wereda, President of the Interim Administration of Tigray, delivered a sobering address, emphasizing that while peace remains the priority, the region must remain prepared for any eventuality.
The President acknowledged that this year’s remembrance comes at a precarious time. He described the current atmosphere not as one of comfort, but as one defined by "heavy political tension."
"We are carefully nurturing the relative peace we have in our hands," President Tadesse stated. "However, there are circumstances where forces beyond your capacity emerge, forcing you to make decisions you would not otherwise choose."
In a pointed message regarding the region's security & political stance, the President underscored that peaceful options must......
Read more: https://addisstandard.com/?p=55799
#Ethiopia: Interim President says dialogue under #Pretoria Agreement remains possible as #Tigray forces withdraw from Tselemti
Tigray advanced forces have withdrawn from #Tselemti in what the Tigray Interim Administration described as a confidence-building measure aimed at demonstrating readiness for dialogue and a peaceful resolution to the current tensions, Interim President Lt. General #Tadesse said.
“Our withdrawal shows clearly that we have no desire to return to war,” General Tadesse said, adding that “there is no question that can be answered by war, but by peace and negotiation.”
Speaking on Saturday to Tigrai Television, he stressed that the situation does not have to escalate into full-scale conflict, emphasizing that dialogue remains both possible and preferable.
The Interim President said Tigray’s core demands remain unchanged, centering on the return of internally displaced persons (#IDPs) and the restoration .....
Read more: https://addisstandard.com/?p=54888