В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Here are some ways to keep your food safe from rodents⬇️
✅Store your food in tightly covered containers
✅Clean your environments regularly
✅Put rodent repellents around your food store
✅Seal all cracks, gaps, or holes in your homes to prevent entry of rodents
#STOPLassaFever
Rats and mice constantly urinate & defaecate, contaminating every surface they touch
Keep your homes & communities clean to prevent direct or indirect contact with rats
➡️Properly dispose of waste from your homes
➡️Do not defecate in open areas
➡️Sweep your floors regularly, removing crumbs or food remnants
#STOPLassaFever
Not all fevers are malaria!
Report early to a healthcare facility when experiencing #LassaFever-associated symptoms.
Early symptoms of #LassaFever include fever, body weakness, sore throat, muscle & chest pain, nausea, vomiting, diarrhoea, cough & abdominal pain.
#STOPLassaFever
Do NOT eat food or drink water contaminated with the urine, faeces, saliva, or blood of rats.
Food safety is key in the prevention of #LassaFever:
✅Store all foods properly in tightly closed containers
✅Ensure proper hygiene when preparing & eating food
#STOPLassaFever
Food safety is key in the prevention of infectious diseases like #LassaFever.
Maintain these safety measures :
✅Store all foods properly in tightly closed containers
✅Ensure proper hygiene in the preparation & consumption of food
#STOPLassaFever
Preventing #LassaFever starts with simple habits!
Remember: 20 seconds of regular handwashing with soap and water can save lives🧼
Let's keep our hands clean and our loved ones safe.
#STOPLassaFever#HandHygiene
🛑 Lassa Fever is highly infectious!
Your hands can carry more than you think — keep them clean to stay safe.
🧼 Wash regularly with soap under running water.
💪 Protect yourself. Protect others.
#LassaFever#HygieneIsKey#NCDCNigeria#StopLassaFever