В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🌎 Hidden off the Pacific coast of California, the Point Dume Submarine Canyon plunges over 800 meters deep just a short distance from shore. Scientists have discovered mysterious methane seeps and rare deep-sea corals within the canyon. These underwater features support unique ecosystems not found anywhere else nearby. ✨
#ocean⚡#canyon⚡#ecosystems
👉subscribe Interesting Planet
👉more Channels
🌎 In Serbia’s Vratna Canyon, stone arches called natural bridges tower up to 30 meters high. These rare formations result from rivers slowly eroding the limestone over millennia, leaving behind immense rock spans. Only three such natural bridges exist in the canyon, making it one of Europe’s most unusual geological sites. ✨
#geology⚡#Serbia⚡#canyon
👉subscribe Interesting Planet
🌄🌿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
🫶 Dear subscribers! We delighted that you're following our channel!
On our channel, you'll find everything about travel!
By using hashtags, you can easily find the content that interests you.
CHANNEL CONTENT:
📹#videoclips
🧭#expedition
🏔️#hiking
🤿#diving
🧨#unusualplaces
⛩#bridges
🏔#mountains
⌛️#facts
✈️#airplanecemeteries
🗻#hills
🏜#discoveries
🏖#beaches
🈴#China
🕌#India
💒#temples
🏤#architecturalmasterpieces
🚆#journeys
🏜#vacations
🎇#UNESCO
⛰#cliffs
🌋#canyon
🌊#lakes
🏢#skyscrapers
⛲️#waterfalls
⛴#dam
🏕#inaccessibleplaces
🌋#volcano
🚀#traveladvice
🌊#sea
🌲#forest
🏝#island
🌅#desert
🌫#ponds
⛰#cave
⭐️#travelhacks
⛺️#nationalpark
Thank you for being a part of our travel community!
Happy exploring!
🪐Discover upcoming expeditions — https://4elementos.shop