В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
2019 Hong Kong Polytechnic University (PolyU) Siege Timeline:
- Nov 17: Police initiate surround of PolyU campus, sealing exits and leading to standoff.
- Nov 18: Intense clashes erupt with police using tear gas, water cannons, and live-round warnings; hundreds trapped inside.
- Nov 19-21: Siege drags on; some attempt escapes and are arrested; medics and clergy enter to assist.
- Nov 22-29: Siege gradually ends with remaining individuals surrendering or being arrested; over 1,000 arrests and hundreds injured in total.
- Police Brutality Details: As reported by BBC and Reuters, police employed excessive force, including firing thousands of tear gas rounds, rubber bullets causing fractures and head injuries, beatings of those trying to flee, and denying medical aid; Human Rights Watch documented allegations of torture, such as forced kneeling and assaults.
#HongKongProrest2019
#FreeHongKong
#PoliceBrutality
Minneapolis Nurse Killed by Federal Agents Was Holding a Phone, Not a Gun
Federal agents shot and killed Alex Jeffrey Pretti, a 37-year-old ICU nurse and American citizen with no criminal record, in Minneapolis this weekend—claiming he was a domestic terrorist intent on a “massacre.” But videos analyzed by The New York Times show Pretti stepping between a woman and an agent who was pepper-spraying her, holding only a phone in one hand. His gun remained concealed until agents removed it from him, and he was shot in the back while lying on the ground, with at least 10 rounds fired.
Federal officials, including President Trump and Homeland Security Secretary Kristi Noem, declared Pretti a threat without evidence, claiming he intended “maximum damage.” Their narrative contradicts the video: Pretti was not seen reaching for a weapon, and agents opened fire after he was already subdued. Local authorities say he had a legal permit to carry, and his colleagues described him as a compassionate nurse and friend—
“the default look on his face was a smile,”
said one coworker.
Protests erupted in Whittier Park, with at least 1,000 people demanding justice despite subzero temperatures. Mayor Jacob Frey accused the Trump administration of terrorizing the city, asking,
“How many more Americans need to die or get badly hurt for this operation to end?”
State investigators were blocked from the scene by federal agents, who insisted on leading the investigation themselves—despite having made claims they couldn't substantiate.
So who’s really the threat here? A nurse trying to help, or federal agents rewriting the story to justify their actions?
#policebrutality#minneapolis#federalagents#justice#Trump
📱American Оbserver - Stay up to date on all important events
🇺🇸
2019年8月31日晚上,香港防暴警察衝入太子站月台及列車車廂,無差別襲擊乘客。多段影片顯示警員使用警棍及胡椒噴霧攻擊手無寸鐵的市民,導致多人受傷。事件震驚全港,至今仍有大量細節未被公開,亦引發持續的悼念與追究行動。
六年過去,真相仍未水落石出,但我們拒絕遺忘。香港人在加拿大,繼續企出嚟!
拒絕遺忘.拒絕原諒
喺重要日子繼續發聲!
On the night of August 31, 2019, Hong Kong riot police stormed Prince Edward Station and attacked passengers indiscriminately. Videos showed officers using batons and pepper spray inside train carriages and on platforms, injuring civilians. The incident shocked the city and sparked ongoing calls for truth and accountability.
6 years later, the truth remains hidden—but Hongkongers in Canada refuse to forget.
Vancouver
Date: Sunday, August 31, 2025
Time: 2:00–3:00 PM
Location: Science World
Hosted by Vancouver Hongkongers 溫哥華手足
Toronto
Date: Sunday, August 31, 2025
Time: 2:30 PM
Location: Toronto Chinese Embassy
Organized by @tadctoronto Toronto Association for Democracy in China 多倫多支聯會
#831PrinceEdward#NeverForget#NeverForgive#PoliceBrutality#HKProtests#831Anniversary