В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Pseudocyesis is a rare condition where a woman believes she is pregnant, but she is not. The body can show real signs like a swollen belly, missed periods, nausea, and even feeling movement. It is linked to strong emotional or mental stress. 🧠
[Read more]
#Pseudocyesis#MentalHealth#MedicalFacts#Health@googlefactss
A 15-year-old girl in Lesotho, in 1988, got pregnant after swallowing sperm during oral sex. She had no vaginal opening and was stabbed in the stomach after being caught by her ex. Doctors believe sperm from her mouth entered her body through stomach wounds and caused pregnancy. The baby was born via cesarean. 🚼🤯
[Read more]
@googlefactss
#Pregnancy#MedicalFacts#UnusualCases#Science
A red blood cell count measures how many red blood cells are in a tiny drop of your blood (one microliter).
Normal ranges:
- Men: 4.0 to 5.9 million cells per microliter
- Women: 3.8 to 5.2 million cells per microliter.
To help you picture it: a microliter is about the size of a small grain of sand.
Low counts may mean anemia. High counts may be from smoking or dehydration.
[Read more]
@googlefactss#Health#BloodTest#RedBloodCells#MedicalFacts
A cryptic pregnancy is when a woman doesn’t know she’s pregnant. It can happen if she has irregular periods, no typical signs, or gets a negative test.
🤰🚫
[Read more]
@googlefactss
#CrypticPregnancy#Pregnancy#HiddenPregnancy#MedicalFacts
Adults in some countries like for example Belgium and the Netherlands are in organ donor registers. Many do not actively choose, so they are listed as “no objection.” Around half are donors. Some actively say yes, some say no. Young adults often take no active choice and are donors by default.
Fun fact, there is no age limit for organ donation.
The oldest donor was 95 years old.
🫀📝🌍
[Read more 1]
[Read more 2]
[Related poll]
@googlefactss
#OrganDonation#Health#DonorRegister#MedicalFacts#Awareness#YouthHealth