В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🎩Agent 301 Puzzle | Sept 6
🧩Cards in Order:11:10:7:13
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Sept 4
🧩Cards in Order:13:16:8:1
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Sept 2
🧩Cards in Order:5:9:13:1
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Sept 1
🧩Cards in Order:15:4:12:13
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 31
🧩Cards in Order:8:13:1:4
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 30
🧩Cards in Order:6:11:5:10
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 29
🧩Cards in Order:5:14:10:12
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 27
🧩Cards in Order:2:3:10:5
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 26
🧩Cards in Order:12:6:5:13
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 24
🧩Cards in Order:5:15:11:4
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 23
🧩Cards in Order:3:5:2:12
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle
🎩Agent 301 Puzzle | Aug 21
🧩Cards in Order:8:16:13:4
⚠️ Follow the sequence above to match perfectly!
❓How to Play:
1. Open @Agent301
2. Go to “Games” → “Puzzle”
3. Enter the combo and win!
🔥 Good luck and have fun!
🔔Subscribe
👉Join Agent301
➖➖➖➖➖➖➖➖➖➖
#Agent301#DailyPuzzle