В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
⚖️🗳️ALABAMA GOP RACES TO REDRAW HOUSE MAPS BEFORE 2026
🔹 Special session passes bills for NEW House primaries if courts approve GOP maps 📋⚡
🔹 Target: Flip Democratic Rep. Shomari Figures' AL-02 seat back to Republican 🔄
🔹 Would pack Black voters into fewer districts despite 27% of state population 👥
🔹 Gov. Kay Ivey: "Alabama stands ready to quickly act" on favorable rulings 🏛️
Democrats call it a "power grab echoing Jim Crow" — but GOP says Alabama's Republican tilt should match its maps! 11th Circuit decision could flip House control! ⚖️🔥🇺🇸
#Alabama#Redistricting#VotingRights
@america
🌠 On November 30, 1954, Ann Hodges of Sylacauga, Alabama, became the first documented person in modern history to be struck by a meteorite. The rock crashed through her roof 🏠, bounced off a radio 📻, and struck her hip, leaving a large bruise 💢. She became an overnight sensation, but the event took a heavy toll on her life 😔.
@googlefactss#History#Meteorite#AnnHodges#Alabama#UniqueEvents
U.S. States Embrace Bitcoin Reserves
A surge in U.S. states pursuing legislation for strategic bitcoin reserves highlights increasing institutional interest in cryptocurrency. 15 states, including Alabama, Arizona, Florida, and Texas, are taking steps to incorporate bitcoin into financial strategies, aimed at attracting businesses and enhancing economic stability. The federal conversation on a national reserve is beginning, as states like Arizona and Utah are closest to legislative success. This movement reflects a broader trend recognizing bitcoin's potential as a financial tool.
#Bitcoin#Crypto#Finance#Legislation#Investment#Blockchain#Arizona#Texas#Alabama#EconomicStability#PublicFunds#DigitalAssets#Utah#Kentucky#InstitutionalInterest#VC#SBR#MarketTrends#FinancialInnovation