В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
#GTC/USDT analysis :
#GTC is currently retracing towards the 200 EMA, creating a potential long opportunity on lower time frames (LTF). The price has bounced back from the support zone and is anticipated to test higher levels.
TF : 2h
Entry : $0.418
Target : $0.469
SL : $0.385
#GTC/USDT analysis :
#GTC is currently in a downtrend, marked by a series of lower lows (LLs) and lower highs (LHs). The price is trading within a resistance zone, encountering significant resistance. Consequently, a continuation of the decline is anticipated from this level, with the price likely to test lower levels in the near future.
TF : 4H
Entry : $0.658
Target : $0.560
SL : $0.722
#GTC/USDT analysis :
#GTC has broken below support levels. The price is expected to continue falling and test lower levels, as the higher time frame (HTF) is bearish. Wait for the price to retest the zone before entering a short position.
TF : 4h
Entry : $0.644
Target : $0.596
SL : $0.678
#GTC/USDT UPDATE:
#GTC is now trading around 1.27$. #GTC has broken out a Inverse Head and shoulder pattern on hourly time frame. So the Possible scenario is According to the pattern, we can see short term bullish momentum in it and we can see the price pump 15-20%. Stay tuned with us for further updates✔️
#GTC
The coin looks very good, there is buying, there is reaction from the zones, waiting for further markup of the asset to cover the upper weekly imbalance
📈Sign up on Bybit to trade with me