В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
#Premiering_now: From Newsroom to Frontline: Mistresillasie on Power, War & Resistance
#TsedaleLemma speaks with #MistresillasieTamrat.
Click here to watch: https://www.youtube.com/watch?v=JCF8w7rEYhQ
#TheStandardSignal#EthiopiaPolitics#Misteresillasie#ElectionDebate
#PoliticalVoices#WomenInPolitics
#Coming_UP: The Standard Signal | Ep.17: From Newsroom to Frontline: Mistresillasie on Power, War & Resistance
#TsedaleLemma speaks with #MistresillasieTamrat.
From her striking statement, “politics took journalism away from me,” to her defense of possible participating in upcoming elections, Mistresillasie speaks with clarity.
Premiers at: 7:30 PM EAT tonight.
Subscribe to watch: https://www.youtube.com/@AddisStandard
#TheStandardSignal#EthiopiaPolitics#Misteresillasie#ElectionDebate
#PoliticalVoices#WomenInPolitics
#Coming_UP: The Standard Signal |Ep. 12 - Western Tigray and the Unraveling of Ethiopia’s Constitution. Part I
Five years after the war in Tigray began, and three years after Pretoria, Western Tigray remains the clearest sign that Ethiopia’s war has not truly ended, it has merely changed form.
If peace doesn’t restore rights, is it really peace? If people cannot return safely and with dignity, what does return even mean? Is Ethiopia still governed by its Constitution?
#TsedaleLemma speaks with #DanielBerhane.
Part I premiers at: 7:30 PM tonight.
Subscribe to watch: https://www.youtube.com/@AddisStandard
#Ethiopia, #Tigray#WesternTigray#ConstitutionalOrder#PeaceAndJustice#IDPRights#RuleOfLaw#HornOfAfrica#PostPretoria
The Standard Signal Ep 16| Two Years Without Justice: Remembering the Brutal Assassination of Bate Urgessa
On April 9, 2024, Bate Urgessa was brutally assassinated by government forces.
This special episode revisits the timeline, and what it reveals about justice and political space in Ethiopia today.
#TsedaleLemma in conversation with #EzekielGebissa
Premiers tonight at 7:30 PM EAT
Subscribe to watch: https://youtube.com/@addisstandard
#BateUrgessa#Ethiopia#Anniversary#JusticeDelayed#HumanRights#PoliticalViolence#Oromo#OLF#Accountability#HornOfAfrica#TheStandardSignal
#Coming_UP: The Standard Signal | Ep. 13 - The UK’s “New Africa Approach”: Press Freedom, Human Rights, Investment, Migration, and Power Politics in Ethiopia
What’s actually new about the UK’s “New Africa Approach”?
#TsedaleLemma speaks with #LukeBullock
Premiers at: 7:30 PM EAT tonight.
Subscribe to watch: https://www.youtube.com/@AddisStandard
#TheStandardSignal#UKAfricaPolicy#UKInEthiopia#HornOfAfrica#Geopolitics#DevelopmentAndSecurity#ForeignPolicy#Ethiopia#RedSea#Tigray#Eritrea#Somaliland#Israel
#Coming_UP: The Standard Signal | Ep. 11: Meles Zenawi’s Nightmare Revisited: GERD, Gulf Money, and the Unmaking of Sovereignty
Fifteen years ago, Ethiopia’s late Prime Minister Meles Zenawi warned that his nightmare would be an “Egyptian agenda financed by Gulf money.”
Has Meles Zenawi’s nightmare already arrived?
#TsedaleLemma speaks with #JawarMohammed.
Premiers at: 7:30 PM tonight.
Subscribe to watch: https://www.youtube.com/@AddisStandard
#GERD#HornOfAfrica#Ethiopia#GulfPolitics#UAE#SaudiArabia#NilePolitics#AfricanGeopolitics#Sovereignty#MiddleEastAfrica#TheStandardSignal
#Coming_UP: The Standard Signal | Ep.15: Ethiopia Under Pressure: Fuel Crisis, Global & Regional Instability, a Fragile Election | Jawar Mohammed
#TsedaleLemma speaks with #JawarMohammed about the growing challenges facing Ethiopia, from global and regional tensions to domestic instability, corruption and Ethiopia’s fragile election.
Premiers at: 7:30 PM EAT tonight.
Subscribe to watch: https://www.youtube.com/@AddisStandard
#AddisStandard#TheStandardSignal#Ethiopia#JawarMohammed#EthiopiaPolitics#Corruption#FuelCrisis#HornOfAfrica#Tigray#Amhara#Oromia#EthiopiaElection#AfricaPolitics#EthiopiaNews#AfricanPolitics#Geopolitics