В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
年屆77歲的香港傳媒大亨黎智英,其牢獄歲月於周五(7日)踏入第1500日。他是許多被中國共產黨在香港監禁的政治犯之一,法治已完全消失。
英國人權組織《香港監察》創辦人羅傑斯呼籲全球領導人營救黎智英,並敦促教宗方濟各關注其信仰權利,釋放這位虔誠的天主教徒。
#黎智英#JimmyLai#蘋果日報#新聞自由#人權
At 77, Hong Kong media mogul Jimmy Lai has spent 1,500 days in prison as of Friday (7th). He is one of many political prisoners jailed by the CCP in Hong Kong, where the rule of law has vanished.
Benedict Rogers of Hong Kong Watch calls on global leaders to rescue Lai and urges Pope Francis to advocate for his release, considering his rights as a devout Catholic.
#JimmyLai#AppleDaily#FreePress#HumanRights
Trump’s War on the Press: Lawsuits, Payoffs, and Intimidation
President Trump has escalated his legal campaign against the media, settling some suits, losing others, and keeping a handful of major outlets in his crosshairs. ABC and CBS both coughed up millions—$15 million and $16 million respectively—to avoid protracted battles, with settlements coming suspiciously close to big regulatory approvals for their parent companies. Critics say these payouts are less about justice and more about buying peace with a president who wields the threat of retaliation like a club.
But the fight isn’t over. Trump’s lawsuits against The New York Times, The Wall Street Journal, and the BBC are still grinding through the courts, with claims ranging from defamation to election interference. Legal experts widely agree that most of these cases are weak, but media owners are wary: refusing to settle could mean more lawsuits, regulatory headaches, or even targeted attacks from the administration.
“This is merely an attempt to stifle independent reporting and generate PR attention, but The New York Times will not be deterred by intimidation tactics.”
— NYT spokesperson
Trump’s playbook is clear: sue, threaten, and settle. The message to the press is unmistakable—cross the president, and you might pay dearly, whether in court or at the negotiating table. But as the lawsuits pile up, the question remains: is this about protecting his reputation, or about silencing the watchdogs?
Who’s really afraid of whom?
#Trump#media#lawsuit#freePress#NYT#WSJ#BBC#intimidation
📱American Оbserver - Stay up to date on all important events
🇺🇸