В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Silencing Operation Part 3:
Influencers and even pro-Beijing Commentator who criticized the government for the fire has their articles and posts taken down all because of obvious and unavoidable factors.
University’s also block the walls where students stick their banners to show gratitudes to the victims.
Opinions and gratitudes are treated as a kind of hate speech to the Hong Kong Government.
多名網紅及甚至親北京評論員因批評政府在 #宏福苑火災 事件上的處理,其文章及貼文均被刪除,一切皆因「不可抗力因素」。
大學亦封鎖牆壁,阻止學生張貼橫額以向受害者表達慰問。
意見及慰問均被香港政府視為一種仇恨言論。
#HongKongFire#TaiPoFire#NSL
政務官流失、港府治理危機愈見清晰
國安法實施五年後,已有50名首長級政務官辭職,單是去年便有11人離任,較前一年倍增。葉劉淑儀指出,部分政務官不願承受政治壓力,選擇高薪及自由,轉向商界或公營機構。如今,公務體系人手短缺,港府面對金融風險及持續移民潮,更顯力不從心。政府管治能力備受考驗,離職潮反映官員與政府的意見分歧,難以忽視。
#香港政治#國安法
AO resignations underline growing governance crisis in Hong Kong
Five years after the National Security Law’s introduction, 50 senior Administrative Officers have resigned—11 just in the past year, nearly double the prior figure. Regina Ip attributes this trend to officials unwilling to engage in political duties, seeking better pay and freedom in other sectors. With dwindling manpower, financial instability, and increasing emigration, the government is clearly struggling to manage the city. These departures signal not just professional fatigue, but profound disagreement with the administration’s direction.
#FreeHongKong#NSL
Due to China's increasing influence and the implementation of a new national security law, Hong Kong's economic position has been severely shaken. The erosion of the city's autonomy and the tightening grip of Chinese authorities have raised concerns among international businesses, leading to a decline in investments and a loss of confidence in Hong Kong as a global financial center. This, coupled with the redirection of cargo and the restructuring of shipping routes, has further diminished Hong Kong's economic prospects.
https://www.rfa.org/cantonese/news/hk-link-04042024161154.html
#ChinaInfiltration#NSL#freeHK#standwithhongkong
監獄規則修訂 引發強烈憂慮
香港政府最新修訂《監獄規則》,容許懲教署以「維護國安」為由,限制律師、宗教人員與在囚人士接觸,立即生效,卻延至 7 月 23 日才提交立法會審議。
此舉可能完全封鎖數以千計的政治犯與外界聯繫。外界無從得知港府在囚室內的行為,尤其中懲教機構推行「思想重整」計劃,更有年輕囚犯曾透露遭受性侵犯。
這不是安全措施,是孤立、是剝奪。
Prison Rule Changes in Hong Kong Spark Alarm
The Hong Kong government’s new amendments to prison rules now permit correctional authorities to restrict inmate access to lawyers and religious staff for “national security” reasons. Though enacted on July 18, the changes won’t face legislative review until July 23.
This effectively blocks thousands of political prisoners from contacting the outside world. The public may never know what happens behind prison walls—especially as reports emerge of indoctrination programs and teenage inmates alleging sexual abuse.
This isn’t about security. It’s isolation, erasure, and silencing.
#silencingHongKong#NSL#PoliticalPrisonersHK#StandWithHongKong
政府於周二(24日)刊憲,保安局局長鄧炳強行使《維護國家安全條例》,對七名涉嫌違反《國安法》的海外人士採取針對措施,包括撤銷特區護照、禁向他們提供資金等。
這是政府第二度依據該條例對潛逃者採取行動。鄧炳強表示,這些人潛逃海外後仍從事危害國家安全的活動,並會議外國官員請求制裁香港官員。這一行動顯示出香港政府對海外港人的威脅,試圖阻止人們發聲,壓制言論自由。
#國安法#香港#言論自由
On Tuesday (24th), the government published a notice, with Secretary for Security Chris Tang invoking the National Security Law to take targeted measures against seven overseas individuals suspected of violating the law, including the revocation of their SAR passports and prohibition of funding.
This marks the second time the government has acted against fugitives under this law. Tang stated that these individuals continued to engage in activities harmful to national security after fleeing overseas, including meeting foreign officials to request sanctions against Hong Kong officials. This action reflects the Hong Kong government's threats to overseas Hongkongers and attempts to silence voices, suppressing freedom of speech.
#NationalSecurity#NSL#HongKong#Government#FreedomOfSpeech
在終審法院的「香港支援愛國民主運動聯盟拒交資料案」中,律政司主張警方只需「合理理由相信」該聯盟是「外國代理人」,而不需提供證據。這樣的解釋實在荒謬,難道任何人都能因警方的懷疑而被逮捕?
鄒幸彤指出,這種「合理相信」的邏輯就像說「有理由相信鹿是馬」。這樣的情況不僅損害法律公正,更使我們對香港法治感到失望。讓我們捍衛法治與正義!
#國安法#支聯會#法律荒謬#捍衛自由
In the "Hong Kong Alliance in Support of Patriotic Democratic Movements of China Refusal to Provide Information Case," the DOJ claimed the police only need "reasonable belief" that the alliance is a "foreign agent" without evidence. This interpretation is ridiculous—can anyone be arrested based on police suspicion?
Shiu Ka-chun noted that this "reasonable belief" logic is like saying "there's a belief that a deer is a horse." Such a situation undermines legal integrity and leaves us disillusioned about the rule of law in Hong Kong. Let’s defend justice!
#NSL#ruleoflaw#politicalprisoners
香港民意研究所的創辦人鍾庭耀因協助一名「已在海外潛逃的通緝犯」而遭警方調查。警方聲稱這與鍾的民調結果無關,但這清楚顯示出他們正試圖干預調查結果,對學術自由和言論自由造成嚴重損害。
這一行為進一步削弱了香港的國際地位,令人擔憂未來的民主和自由。自2020年國安法實施以來,香港的社會運動和言論自由受到嚴峻挑戰。我們必須警惕這一趨勢,並捍衛我們的權利!
#國安法#香港#鍾庭耀#言論自由#學術自由
Chung Ting-yao, founder of the Hong Kong Public Opinion Research Institute, is under investigation for assisting a “wanted person who has absconded overseas.” While the police claim this is not about Chung’s poll results, it clearly indicates an attempt to interfere with the outcomes, severely undermining academic freedom and freedom of speech.
This action further damages Hong Kong’s international standing and raises concerns about the future of democracy and freedom in the city. Since the implementation of the National Security Law in 2020, social movements and freedom of expression have faced intense challenges. We must remain vigilant against this trend and defend our rights!
#NSL#HongKong#ChungTingYao#FreedomOfSpeech#AcademicFreedom