В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
A study of 1,160 men found that nose size can predict penis size. Larger noses were linked to longer penises. Penis length was also related to lower BMI. Penis circumference was linked to body weight and testicle size. Height, weight, foot size, and testosterone were measured, but nose size and BMI were key for length.
This study supports the old myth about nose and penis size.
👃📏🍌🤏
[Read more]
@googlefactss#Science#BodyFacts#MythConfirmed
The lunula is the white, crescent-shaped part at the base of your fingernail. It shows where new nail cells grow.
💅🌙
@googlefactss
#Lunula#Nails#BodyFacts
The glabella is the smooth area of skin between your eyebrows and above your nose. It helps show facial expressions like frowning.
👁️🗨️🙂
@googlefactss
#Glabella#Face#BodyFacts
The axilla is the medical term for your armpit—the area under your shoulder where your arm connects to your body. It contains lymph nodes, sweat glands, and important blood vessels and nerves.
🦴💪
@googlefactss
#Axilla#Armpit#BodyFacts
The canthus is the corner where your upper and lower eyelids meet, near your eye's edge. It helps protect your eyes and drain tears.
👁️💧
[Read more]
@googlefactss
#Canthus#Eye#BodyFacts
Double body fact today:
●The gnathion is the lowest point on the front of your chin, right in the middle. It’s often used as a reference point in anatomy and facial measurements.
●The zygion is the most lateral point of the zygomatic arch (cheekbone) on your face. It’s often used in anthropology and facial measurements to assess facial width.
😊📏
[Source picture]
@googlefactss
#Zygion#FacialAnatomy#Anthropology
#Gnathion#Chin#BodyFacts