В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
The Dead Rabbit pregnancy test injected a woman’s urine into a female rabbit. If the rabbit’s ovaries changed, she was pregnant. The rabbit was always killed to check. People wrongly thought the rabbit died only if pregnant, thus creating the euphemism "the rabbit died" to say someone was pregnant.
This outdated but effective test killed many rabbits before kinder tests were made.
🐇💉🤰
[Read more]
@googlefactss#PregnancyTest#History#AnimalTesting#OldMedicine#Science
The UK government has unveiled an unprecedented plan to gradually eliminate animal testing in medical and pharmaceutical research.
The first phase will begin at the end of 2026 and will eliminate tests on mice used to develop treatments for skin and eye irritations.
Additionally, the country has committed to reducing the use of dogs and primates in laboratories by 35% by 2030, fulfilling an election promise made by the Labour Party.
Backed by £60 million, the strategy aims to promote ethical and technologically advanced alternatives that replace animal models without compromising the safety of vaccines, medicines, or pesticides.
Although animal experiments peaked in 2015 — with over 4 million animals used — advances in alternative methods had already helped reduce that number.
However, progress has stalled in recent years, so this new initiative seeks to accelerate the full replacement of animals.
Science Secretary Patrick Vallance stated, “Nobody wants to witness animal suffering,” and the new roadmap will allow governments, companies, scientists, and animal welfare organizations to collaborate on faster and more effective solutions.
Part of the investment will go to a specialized center that will integrate technology, data, and expertise to accelerate the transition to animal-free science.
🐾 Do you think Uzbekistan should implement a similar plan to reduce and replace animal testing? 🇺🇿💭
#AnimalWelfare#AnimalFreeScience#UK#AnimalTesting#ScientificInnovation#LabAnimals#ADNMascotas#AnimalNews#AnimalProtection#OneHealth☘️Read the latest environmental news on the @ekologuz page. Follow us and send your suggestions and wishes via @eklguz_bot
Instagram | Facebook | Twitter | Sayt | Youtube.