В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🖊🗞OPINION | Nobel 'Peace' Prize Descends Further Into Farce With Machado Award
From coup attempts to open calls for foreign intervention, Venezuelan far-right leader and 2025 Nobel Peace Prize laureate María Corina Machado has very little to do with peace.
In this article, VA's Ricardo Vaz takes aim at the opposition leader's track record.
🔗Follow the link to read the article: https://venezuelanalysis.com/opinion/nobel-peace-prize-descends-further-into-farce-with-machado-award/
#NobelPeacePrize#VenezuelanOpposition#USForeignPolicy
Duterte congratulates Ressa on Nobel Prize
Philippines President Rodrigo Duterte congratulates journalist Maria Ressa on Nobel Prize.
#News#Reuters#MariaRess#NobelPeacePrize#RodrigoDuterte
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➖
Russia, Philippines journalists win Nobel Peace Prize
Two journalists whose work has angered authorities in Russia and the Philippines, Dmitry Muratov and Maria Ressa, have been awarded the Nobel Peace Prize.
#News#Reuters#NobelPeacePrize#MariaRessa#DmitryMuratov
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➖
🔈PODCAST | No Peaceful Activist: María Corina Machado's Long and Violent History of Regime Change in Venezuela
From taking part in coup attempts to outright calling for a foreign intervention against Venezuela, María Corina Machado's track record screams everything but "peace."
In the latest VA podcast episode, host José Luis Granados Ceja is joined by fellow staff member Andreína Chávez Alava to discuss the role played by the recent Nobel laureate amidst growing US military threats against Caracas.
Follow the link for early access to this episode: https://www.patreon.com/posts/141610226
#MariaCorinaMachado#NobelPeacePrize#Violence#USMilitary
🗓🎉October 7 — Birthday of Archbishop Desmond Tutu (1931–2021)
A fearless anti-apartheid activist, theologian, and the first Black South African Anglican bishop, Desmond Tutu received the Nobel Peace Prize in 1984 for his unwavering fight for justice and equality. ✝️✨
🕊🇿🇦 After South Africa’s first democratic elections in 1994, President Nelson Mandela appointed him to chair the Truth and Reconciliation Commission (TRC) — a crucial step toward national healing after decades of apartheid.
💬Quotes by Desmond Tutu:
• “If you want peace, you don’t talk to your friends. You talk to your enemies.”
• “Hope is being able to see that there is light despite all of the darkness.”
• “Without forgiveness, there is no future.”
• “If you are neutral in situations of injustice, you have chosen the side of the oppressor.”
• “Children are a wonderful gift. They have an extraordinary capacity to see into the heart of things and to expose sham and humbug for what they are.”
#DesmondTutu#SouthAfrica#History#NobelPeacePrize#HumanRights#Mandela
🇿🇦On July 21, we honor the legacy of Albert John Luthuli (1898–1967) — South African political leader, anti-apartheid activist, and president of the African National Congress (ANC).
🏆 In 1960, Luthuli became the first African recipient of the Nobel Peace Prize for his unwavering commitment to nonviolent resistance against racial oppression in apartheid South Africa.
✊ His moral leadership, courage, and commitment to equality continue to inspire generations.
💬 "I am a man of peace. My country can be free—without violence."
🕊 We remember.
#AlbertLuthuli#SouthAfrica#NobelPeacePrize#HumanRights#AntiApartheid#History#Freedom#ANC