В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🪐 The quasar 3C 273, located in the constellation Virgo about 2.4 billion light-years from Earth, was the first quasar ever identified and remains one of the brightest in the sky. A quasar is a super-energetic beacon powered by a supermassive black hole devouring matter, shining so brightly that it can outshine entire galaxies, and 3C 273 helped scientists understand just how extreme and distant these cosmic engines can be. ✨
#quasars⚡#astronomy⚡#virgo⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The distance from Earth to the Virgo Cluster, a giant grouping of galaxies, is about 55 million light-years—meaning the light we see from its member galaxies, like Messier 87, began its journey long before the first dinosaurs appeared on our planet. Even within the Virgo Cluster, galaxies can be separated by hundreds of thousands of light-years, showing that cosmic neighborhoods are staggeringly vast compared to our entire solar system. ✨
#spacedistances⚡#galaxies⚡#virgo⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 Far out in the Virgo Cluster, astronomers observed a rare cosmic event called an "ultra-compact dwarf galaxy collision," where two tiny, densely packed galaxies like M60-UCD1 have smashed together. The aftermath of such a collision can create ultrabright X-ray sources and disrupt the structure of both galaxies, showing that even small galaxies can undergo dramatic and strange transformations when they collide in deep space. ✨
#cosmicphenomena⚡#collisions⚡#virgo⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
La manera de hacer enojar a cada signo😤:
#Aries♈️: Ignorandolo.
#Tauro♉️: Pedirle más de lo que puede hacer.
#Geminis♊️: Presionarlo a hacer algo que no quiere hacer.
#Cancer♋️: Obligale a admitir que está equivocado.
#Leo♌️: Niego sus palabras.
#Virgo♍️: Que le lleven la contraria en lo que sea.
#Libra♎️: Excluyendole de tus planes.
#Escorpio♏️: Cometiendo errores absurdos.
#Sagitario♐️: Cancelando un plan a última hora.
#Capricornio♑️: Dile cómo tiene que hacer las cosas.
#Acuario♒️: Cortale las alas.
#Piscis♓️: No le des las gracias nunca.
@EsTuHoroscopo.🔮
Lo que a los signos mas les gusta de su pareja🥰:
#Aries♈️: Que le dejé ponerse sus sudaderas.
#Tauro♉️: Que le haga una playlist.
#Geminis♊️: Que le dejé hablar de sus pasiones.
#Cancer♋️: Que hable de sus sentimientos sin timidez.
#Leo♌️: Que le diga que es el/la más guapx.
#Virgo♍️: Que siga hablándole aunque desaparezca durante días.
#Libra♎️: Que tengan el mismo gusto musical que él/ella.
#Escorpio♏️: Que se pueda hablar de cualquier cosa con su pareja.
#Sagitario♐️: Que se ría de cualquier meme que le enseñe.
#Capricornio♑️: Que vea cualquier serie con él/ella.
#Acuario♒️: Que entienda que necesita su espacio.
#Piscis♓️: Que recuerde cualquier pequeño detalle.
@EsTuHoroscopo.🔮