В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
#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
#Antimicrobials are vital in fighting infectious diseases across humans, animals, and plants.
However, their effectiveness is diminishing, leading to a growing and urgent crisis known as #AntimicrobialResistance.
Let’s promote the responsible use and work together to combat #AMR.
#Handwashing is a basic and effective tool against infections.
If we do not become sick, we would not need to use #antimicrobials.
Encourage your loved ones to practice frequent #handwashing with soap under running water.
Do your part to prevent #AntimicrobialResistance
#Antimicrobials are becoming less effective against common infections in animals & humans.
🚫 Do not self-medicate
✅ Visit a healthcare professional when sick
Everyone has a role to play to ensure #antimicrobials continue to work.
#AMR#WAAW2023
#AntimicrobialResistance is a global concern affecting everyone, everywhere, including users & non-users of #antimicrobials
Our National Action Plan for Antimicrobial Resistance incorporates a #OneHealth approach to contain #AMR in Nigeria
Read & share:
https://ncdc.gov.ng/themes/common/docs/protocols/77_1511368219.pdf
#AntimicrobialResistance is one of the top 10 health threats in the world.
Everyone everywhere, including users and non-users of #antimicrobials have a role to play to prevent #AMR.
#BeAntimicrobialAware
Every year, the National Antimicrobial Resistance Technical Working Group joins the global community to raise awareness of the dangers of misuse or overuse of #antimicrobials.
Fighting #AMR is a global endeavour that must be addressed through a #OneHealth approach as evident in this year's theme of #WAAW2023: ‘Preventing #AntimicrobialResistance together”
🔗Press Release
https://ncdc.gov.ng/news/504/nigeria-joins-the-global-community-to-commemorate-world-antimicrobial-awareness-week-%28waaw%29
Misuse or overuse of #antibiotics💊 & other #antimicrobials can reduce its effectiveness in treating common infections in animals & humans.
From 18th-24th November, we are joining the global health community to mark the annual #WorldAntimicrobialAwarenessWeek2022 .
#StayTuned
#AntimicrobialResistance is when medicines like #antimalarials, tetracycline, septrin, and amoxicillin no longer treat diseases they cured previously.
Everyone everywhere, including users and non-users of #antimicrobials has a role to play to prevent #AMR.
#BeAntimicrobialsAware