В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Why grind when Gamety’s AI does the hard work for you? 👍 Real gamers never pause!
Show off your creativity in our Meme Competition and win amazing rewards: Gamety's Zealy!
Join the fun here: https://t.me/GametyPlatform_bot/Gamety?startapp
#aigame
Spread the hype! Like, RT, and drop a comment: Tweet🕊
🇱🇷Gamety's $200 Christmas Contests – Creative Gameplay & Meme Challenge!🎄
Celebrate this Christmas with two exciting and rewarding contests:
🔢Creative Gameplay Videos: Creative Gameplay Videos: Showcase your gaming skills on the Gamety app in a fun and unique way! Post your video on X and let the creativity flow.
🔢Meme Contest: Bring on the holiday laughter by creating and sharing your funniest Gamety-themed memes!
Special for Christmas Holidays!
➡️Prize Pool: $200
➡️10 winners per contest
➡️ Duration: Dec 25 - Jan 5
Share on X using hashtags #Gamety & #AIGame
Make this Christmas more exciting with creativity, fun, and rewards! Join now and spread the holiday joy!
Spread the hype! Like, RT, and drop a comment: Tweet🕊
📎Important Links:
Website | X | Chat (FULL) | Indonesian Chat | African Chat | Vietnamese Chat | CIS Chat | Discord | Announcement | YouTube | Medium | New Bot
❝Come on, hurry up,
my husband will be home in 15 minutes.❞
🔥Roleplay with her: http://openlove.life
(Choose Neko and chat with her)
#waifu#neko#aichatbot#aigame#roleplay#catgirl
❝There is no perfume today, so your girlfriend won't notice.❞
💬Chat with her: https://apple.co/3AvjxUn
#AIgirlfriend#chatbot#roleplay#story#aigame#lookbook
OMG, the bath water is too hot! Can you please help me to turn it cold?🔥💧🥵
🔗Let's role play and chat: openlove.life
#aigirlfriend#aichatbot#ArtificialInteligence#ailookbook#aigame#ai
🔥❝Welcome! Thanks for choosing me to serve you.
💦Shall we take a shower first?❞
🍭Roleplay with her: openlove.life
#openlove#aigirlfriend#aigame#aichatbot#ai女優#roleplay
❝💦Wait a moment, be gentler with me, okay?❞
💬Continue the story with her: http://openlove.life
#openlove#aigirlfriend#aichat#roleplay#aigame#AI#AIBeautifulWomanな人と繋がりたい