В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
#XTZ/USDT analysis :
#XTZ is in an uptrend and has broken out above the 200 EMA and previous highs. Currently, the price is retesting the previous resistance zone, which has now turned into support. It is anticipated that the price will rebound from this level and resume bullish momentum to test the previous highs.
TF : 1D
Entry : $1.012
Target : $1.800
SL : $0.783
#XTZ/USDT analysis :
#XTZ has broken below the 200 EMA and has retested it. Currently, the price is encountering resistance from the resistance zone, and it is expected to decline from here. A drop is anticipated, potentially leading to a test of previous lows.
TF : 2H
Entry : $1.420
Target : $1.150
SL : $1.530
#XTZ/USDT analysis :
#XTZ has broken out and retested the previous swing high and the 200 EMA. The price is expected to bounce back from this level and test the higher levels.
TF : 4H
Entry : $0.694
Target : $0.744
SL : $0.661
#XTZ/USDT analysis :
#XTZ is again approaching the 200 EMA resistance after facing rejection from there and is expected to continue its bearish momentum once the zone is tested. The previous low will be the target level.
TF : 2H
Entry : $0.687
Target : $0.591
SL : $0.709