В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Do not save your drugs for later or share them with another person.
Ensure you complete your dosage as prescribed by a certified healthcare worker.
Play your part to prevent #AntimicrobialResistance.
Dear Healthcare Workers,
Remember that many infections present with similar signs and symptoms. Always maintain a high index of suspicion.
To prevent #AntimicrobialResistance, conduct a test before you treat a patient.
Dear Healthcare Workers,
Remember that many infections present with similar signs and symptoms. Always maintain a high index of suspicion.
To prevent #AntimicrobialResistance, conduct a test before you treat a patient.
#AntimicrobialResistance is a global health issue leading to the ineffectiveness of drugs against the illness they were developed to treat.
Health care practitioners should always conduct a test before prescribing treatment for a patient
Do not save your drugs for later or share them with another person.
Ensure you complete your dosage as prescribed by a healthcare worker.
Play your part to prevent #AntimicrobialResistance.
Do not save your drugs for later or share them with another individual
Complete your dosage as prescribed by a healthcare worker.
Play your part to prevent #AntimicrobialResistance.
#Antimicrobials are not always needed when you are feeling unwell.
Antibiotics should only be prescribed by healthcare professionals after an appropriate diagnostic test.
Be an #AntimicrobialResistance guardian.
#Antimicrobials are not always needed when you are feeling unwell.
Antibiotics should only be prescribed by healthcare professionals after an appropriate diagnostic test.
Be an #AntimicrobialResistance guardian
#Antimicrobials are not always needed when you are feeling unwell.
Antibiotics should only be prescribed by healthcare professionals after an appropriate diagnostic test.
Be an #AntimicrobialResistance guardian
#Antimicrobials are not always needed when you are feeling unwell.
Antibiotics should only be prescribed by healthcare professionals after an appropriate diagnostic test.
Be an #AntimicrobialResistance guardian
The misuse and overuse of #antibiotics💊 & other antimicrobials reduces their effectiveness in treating common infections in animals & humans.
Everyone has a role to play to help fight #AntimicrobialResistance, do your part!
Misuse or overuse of #antibiotics💊 & other antimicrobials can reduce their effectiveness in treating common infections in animals & humans.
Everyone has a role to play to help fight #AntimicrobialResistance, do your part!