В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
👍Un « Régiment des immortels » sous-marin pour honorer la mémoire des soldats soviétiques
À l’approche du Jour de la Victoire, des plongeurs de la région de #Sverdlovsk ont organisé une action originale de mémoire en descendant à 27 mètres de profondeur pour rendre hommage aux soldats soviétiques.
Inspirée du mouvement du « Régiment des immortels », cette initiative symbolique vise à perpétuer la mémoire des combattants de la Seconde Guerre mondiale dans un format inédit.
RT en français • Osez questionner !
❗️#Ekaterinbourg : 50 personnes évacuées d'un immeuble à la suite d'une attaque de drone
Le gouverneur de la région de #Sverdlovsk, Denis Pasler, a indiqué qu'une attaque de drone avait été perpétrée à Ekaterinbourg et qu'un immeuble d'habitation avait été endommagé.
RT en français • Osez questionner !
🗓On December 17, the Honorary Consul of South Africa in Yekaterinburg, Sergey Mazurkevich🇿🇦, took part in a formal reception hosted by the Governor of the Sverdlovsk Region, alongside diplomats and honorary consuls from other countries 🌍🤝
During the event, Governor Denis Pasler summarized the outcomes of efforts to strengthen international cooperation in 2025 and outlined promising areas for cooperation in the year ahead 📈✨
#SouthAfrica#Diplomacy#InternationalCooperation#Yekaterinburg#Sverdlovsk#HonoraryConsul#Mazurkevich
🎉Ural State Pedagogical University (USPU) marks its 95th anniversary today, August 26!
🇿🇦 The Office of the Honorary Consul of South Africa in Yekaterinburg is pleased to join in the congratulations and wishes the university continued growth and success.
📚 After last year’s merger with the Russian State Vocational Pedagogical University, USPU became the largest pedagogical university in Russia.
👨🏫 The university is now led by Acting Rector Yury Biktuganov, who previously served as Minister of Education of the Sverdlovsk region. Not long ago, Honorary Consul of South Africa Sergey Mazurkevich and Mr. Biktuganov held a warm and productive meeting.
#Anniversary#Education#USPU#Sverdlovsk#Yekaterinburg#SouthAfrica#Biktuganov#Mazurkevich
🌄🌿Blyde River Canyon — a 26 km (16 mi) natural wonder in Mpumalanga Province, northeastern South Africa.
It is one of the largest canyons in the world, but unlike the Grand Canyon in the USA, it is covered with lush subtropical vegetation, earning it the name “Green Canyon”. 🌱💚
🏞 The canyon is part of the Blyde River Canyon Nature Reserve.
🌅 In local languages, Mpumalanga means The Place Where the Sun Rises.
🤝 In 2022, the Sverdlovsk Region and Mpumalanga signed a cooperation agreement.
📸 Photos: istockphoto.com
#Nature#Tourism#SouthAfrica#Travel#Canyon#BlydeRiverCanyon#Mpumalanga#Africa#Sverdlovsk