В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
If it’s painful for you to criticize your friends, you’re safe in doing it; if you take the slightest pleasure in it, that’s the time to hold your tongue.
– Alice Miller
#friendship@quietworld🍃
As you get older real friendships don’t mean you see each other everyday. In fact some of the realest friends barely see each other, if you both are really out chasing your bags, tryna better your futures, you probably won’t see each other as often.
#friendship@quietworld🍃
Dear folks, this is a translation of one famous poem of one famous poet into English.
Can you please review it and let me know, if it sounds correct, or does it contain enything weird, odd ?
/********************************************/
I like to feel that I'm not sick with you
I like to know that sickness yours is yours not mine
That heavy ball of earth won’t stray off from its course
Away from our footprints , fading in sunshine
I love that I could funny be
Bewildered, clumsy , not wordplaying
not turning red upon sleeves touching game
not turning pale when see you on your knees
I love to see you hugging someone else
Before my eyes , reposefully and calmly
Not sending me to fire glowing hell
To burn forever for not kissing me , my darling
I like that mentioning my name is not your habit
That tender name you don't utter day-and-night in vain
That no one's gonna sing Hallelujah on our wedding
In silence of the church, one sunny autumn day
Thank you for love, with all your heart and soul
That brings me peace at night, unconscious, unaware
Thank you for rare meetings if at all
So nice, That never in the moonlight do we stroll
So great that sun warms not us, soaring high elsewhere
So pity, that I am not sick with you
So bad, that sickness yours is yours not mine
#review
#friendship