В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
😄Draw
➖➖➖➖➖➖
🔘 Drawis commonly used as a verb that means creating a picture or image
🔜My cousin drew our family using different coloured pencils.
🔜My daughter has just learned to draw!
🔘We can also use the verb ‘draw’ to mean attracting attention - someone wanting to look at something.
🔜The amazing singer drew a huge audience.
🔜A World Cup game is guaranteed to draw a large number of viewers!
🔘 Drawas a noun can also describe competition results that are equal.
🔜The football match ended in a draw – it was 1:1.
🔜This boxer has never lost a fight - he has six wins and a draw.
#Draw👨🏫@America
➖➖➖➖➖➖➖➖➖➖➖➖
🆕 Crypto News @Money
😁 Crypto Game @Egame
🇺🇸 US News @America
🇯🇵 Japan News @Japan
🇦🇪 UAE News @Dubai
▶️ Popular Movies @Videos
😜 Best Funny Video @Funnys
⚠️ The project was suspended. Funds may be at risk.
🌟Starverse — Telegram Stars Farming and Everyday Giveaways
Earning stars has never been so exciting! #Starverse is a game where your tickets turn into real money. A project from the TgLab team, creators of the popular TON Dating mini app.
⏳Farming
Every hour you can turn on farming and take a part of the total income of the players.
Half of all revenue goes to farmers — the more tickets you have, the bigger the drop.
Farm, reinvest and invite friends — you'll get 15% of their purchases.
💰Golden Ticket
Every day at 9:00 UTC a winner is randomly selected and receives 15% of all purchases made during the day.
How to participate:
- farm at least 3 hours a day
- buy at least one ticket on the day of the drawing
💰Easy Withdraw
Got Stars? You can immediately transfer them to your Telegram account or convert to $USDT without delays.
⭐️Start farming now!
#stars#farming#draw#web3