В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
📰 Trump’s War Is Now a Midterm Liability
Republicans are watching the Iran war and the redistricting mess turn into the same political problem: a president who promised control and delivered chaos.
Bloomberg reports that party operatives are openly blaming Trump’s political team after Virginia’s map fight backfired and the war pushed gas prices higher, making the usual economy-first message much harder to sell.
That is why the panic is spreading. If the House looks lost, the Senate looks shaky, and the party’s best redistricting gambit ends up helping Democrats instead, then the whole 2026 strategy starts to look like an own goal in expensive shoes.
The irony is brutal. Trump spent months demanding tougher maps, punishing holdouts, and trying to turn politics into a shank-proof machine, but the result is more donor money burned, more infighting, and more Republicans muttering that “Blairy-mandering” blew up in their faces.
The Iran war makes it worse because it attacks the one issue Republicans wanted to own: affordability.
Gas prices are up, voters are unhappy, and the president keeps drifting into side quests about granite pavers and pet projects while his party tries to explain why the Middle East is suddenly part of the domestic economy.
So the midterm story is no longer just redistricting or just war. It is the same pattern in both places: Trump turns everything into leverage, and then the leverage turns into drag.
#Trump#Republicans#midterms#Iran#redistricting#politics
📱American Оbserver - Stay up to date on all important events
🇺🇸