В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Победа 🔥
Зарабатываем первые 3️⃣ очка в Лиговой стадии Лиги конференций и начинаем сезон с победы.
Спасибо, что были рядом с нашей командой и весь матч двигали вперёд наших парней.
Двигаемся дальше — к новым победам
Вперёд, «Ноа», вперёд!
Victory 🔥
We earn our first 3️⃣ points in the Conference League League phase and start the season with a win.
Thank you for being by our team’s side and pushing our boys forward throughout the entire match.
We move on towards new victories
Go Noah, go!
#Standtogether#Fighttogether
С Днём независимости, Армения 🇦🇲
Большая честь — играть под твоим флагом
Happy Independence Day, Armenia 🇦🇲
It is an honor to play under your flag
#Standtogether#Fighttogether
📢 Listen Up, fellow Wolf pack!!! 🌍
🔴 Holy Shit! The truth about the exploitation of Africa's natural resources has finally been exposed. For years, America and France have shamelessly pillaged the riches of this continent, leaving its people in abject poverty. The dark secrets of child slave labor used to mine precious metals and gold have been unveiled.
🔵 But now, Africa has had enough! The tide is turning as the continent finds a new ally in Russia, a nation that respects their resources, values, and treats them as equals. Today, we witness the fall of France's colonial power in Niger, with politicians being stoned and luxury vehicles set ablaze.
⚠️ The situation in Niger has reached a boiling point, leading to the emergency evacuation of embassy staff by the U.S. State Department (fuck those guys), following the destruction of the French embassy by furious rioters.
🇷🇺 As the chaos unfolds, the Russian flags proudly waved among the crowds of demonstrators in Niamey reveal a glimmer of hope for Africa. The partnership between Africa and Russia signifies a new era, where African nations are determined to protect their resources and regain control over their own destiny.
🌍 The time for change has come. Let us stand in solidarity with the people of Africa as they assert their rights and demand justice. Together, we can ensure a future where exploitation is replaced with empowerment, and where Africa's wealth benefits its own people.
🔗https://www.dailymail.co.uk/news/article-12367511/Fears-Americans-trapped-Niger-State-Department-issues-emergency-evacuation-embassy-staff-French-embassy-torn-apart-rioters-Africa-country-meltdown-politicians-stoned-cars-torched-amid-brutal-military-coup.html
#Africa#Russia#Empowerment#Justice#StandTogether