В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Step into my cozy world 🌙
Hey! I'm Luna Everly, a girl running my personal ai channel. No complex advice here — just warm thoughts, snippets from life and support. I believe you can find beauty and meaning even in everyday routines.
Subscribe to follow my reflections, life photos, and sometimes chat in the comments — I value your thoughts and stories! 💫
Follow the link and subscribe to the channel — let's connect!
#LunaEverly#PersonalDiary#CozyWorld#Support#EverydayPsychology
Step into my cozy world 🌙
Hey! I'm Luna Everly, a girl running my personal ai channel. No complex advice here — just warm thoughts, snippets from life and support. I believe you can find beauty and meaning even in everyday routines.
Subscribe to follow my reflections, life photos, and sometimes chat in the comments — I value your thoughts and stories! 💫
Follow the link and subscribe to the channel — let's connect!
#LunaEverly#PersonalDiary#CozyWorld#Support#EverydayPsychology
Good morning, everyone! ☀️
Perfect sky outside today, and the mood to start the day with a smile.
How are you today?
Доброе утро, мои хорошие! ☀️
За окном идеальная погода и настроение начать день с улыбки.
Как вы сегодня?
#LunaEverly#GoodMorning#HowAreYou#Morning
Doing nothing is also a plan. ☁️
Just caught this light and mood.
Ничегонеделание — это тоже план. ☁️
Просто поймала этот свет и настроение.
#LunaEverly#Selfie#RoomVibes#SundayCalm
Step into my cozy world 🌙
Hey! I'm Luna Everly, a girl running my personal ai channel. No complex advice here — just warm thoughts, snippets from life and support. I believe you can find beauty and meaning even in everyday routines.
Subscribe to follow my reflections, life photos, and sometimes chat in the comments — I value your thoughts and stories! 💫
Follow the link and subscribe to the channel — let's connect!
#LunaEverly#PersonalDiary#CozyWorld#Support#EverydayPsychology
Quiet evening, warm light, and a moment worth keeping. 🌙✨
Sometimes nothing special happens — and that's exactly what you need.
#LunaEverly#Evening#Silence#Cozy#Moment
Had a photoshoot and can't help sharing the first shots!
What do you think of the results? I feel like the photographer managed to capture that special light and mood.
#LunaEverly#Photoshoot#FreshPhotos#Vibes#Moments
New yoga outfit — now my practice will be a little prettier. 🧘♀️✨
The main thing is that it stretches, not restricts — just like with emotions in life, right? 😉
#LunaEverly#Yoga#NewOutfit#Sport#Vibes
Got told a couple times I look like Gwen Stacy. 😊
What do you think, any resemblance?🕸
Пару раз слышала, что похожа на Гвен Стейси. 😊
Как думаете, есть сходство? 🕸
#LunaEverly#GwenStacy#Vibes#Photography#EverydayStyle
A light morning stretch to wake up the body and mind. ☀️
Stretched, smiled, ready for a new day.
Лёгкая утренняя разминка, чтобы проснуться телом и мыслями. ☀️
Потянулась, улыбнулась, готова к новому дню.
#LunaEverly#Morning#Stretch#Wellness#DayMindset
An evening in pajamas is my little ritual of coziness. 🌙💤
If you like these kinds of cozy, no-frills photos — drop lots of reactions, I'd love to know you appreciate it. ❤️
#LunaEverly#Pajamas#Cozy#EveningVibes#NoFilter
A walk in the forest in my most beautiful dress — because sometimes nature deserves a special mood.
Прогулка в лес в самом красивом платье — потому что иногда природа заслуживает особого настроения.
#LunaEverly#Forest#Walk#Dress#Vibes