В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Part 2: Babur, at age 13, wrote in the Baburnama about his feelings for a boy named Baburi:
> “In those leisurely days, I discovered in myself a strange inclination — nay! as the verse says, ‘I maddened and afflicted myself’ — for a boy in the camp‑bazar, his very name, Bāburī, fitting in. Up till then I had had no inclination for anyone… From time to time Bāburi came to my presence but out of modesty I could never look straight at him… I got so confused that I almost went right off.”
💌📖👑
Note: this does not mean he was homosexual. Such feelings can be a normal part of teenage self-discovery.
@googlefactss
#Baburnama#Babur#MughalHistory#HistoricalFacts#LoveInHistory#Memoir#HonestWriting
Part 1: Babur, the Mughal emperor and a Muslim, wrote the Baburnama, a detailed personal memoir. In it, he shared his feelings openly. He wrote about his love and admiration for women. He also felt strong affection and admiration for a boy named Baburi. He described these emotions with honesty and detail. He sometimes wrote poems about his feelings. His writing shows both his emotional sensitivity and his poetic talent. He mixed personal experiences, romantic feelings, and reflections on life. Babur’s memoir is considered important for both history and literature. It gives a rare glimpse into his private thoughts, he was not afraid to show his personal desires and emotions. Both his relationships with women and his emotional attachment to Baburi are part of the memoir. His writing style is clear, candid, and expressive. The writings are valued for its literary quality and honesty.
💌📖👑🕌
[Read more1]
[Read more2]
@googlefactss
#Baburnama#Babur#MughalHistory#HistoricalFacts#LoveInHistory#Memoir#Islam