В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
On July 18, 1898, Marie and Pierre Curie discovered polonium, named after Marie’s homeland, Poland. On December 26, 1898, they announced the discovery of radium, with help from Gustave Bémont. These were two new chemical elements that helped scientists learn more about radioactivity. ⚛️
[Source]
@googlefactss
#MarieCurie#Polonium#Radium#ScienceHistory#Radioactivity
Radioactive scientist? Think of a woman.🩻
Let’s talk about the woman, the myth, the legend—Marie Curie. She didn’t just break through ceilings; she melted them with radioactive elements she discovered herself.
Born Maria Skłodowska in Warsaw in 1867, Marie faced financial hardship early on. But with a prodigious memory and relentless drive, she moved to Paris to study at the Sorbonne. There, she wasn’t just a student, she connected with top physicists like Jean Perrin and eventually met her scientific partner in crime, Pierre Curie. Their partnership wasn’t just a marriage; it was a research powerhouse.
As she was working in the lab, Marie noticed something strange: the mineral pitchblende was more radioactive than pure uranium. How could that happen? Apparently, it contained a tiny amount of some unknown, extremely active element. Pierre joined the hunt, and together they discovered two brand new elements: Polonium (named after her beloved homeland, Poland) and Radium.
While Pierre studied the radiation, Marie did the heavy lifting—literally. She isolated pure metallic radium, with a little help from chemist André-Louis Debierne.
When World War I erupted, Marie didn’t hide in a lab. She pioneered mobile X-ray units, famously called “Les Petites Curies.” These were ordinary cars fitted with X-ray apparatus and driven right to the front lines. She personally secured funding, trained medics, and helped examine over one million wounded soldiers. She essentially brought X-rays to the battlefield and made them an essential medical tool.
….
Swipe through posts to explore the legacy Marie left behind!⚡️
#peopleinstemseries#womeninstem#mariecurie#radioactive#radiumgirls