В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
"Former police commander Luk Chun Chung stands trial for alleged molestation of subordinates in 2022 after dining in Fanling. Victims testify to incidents in restroom. Luk denies charges of molestation, dangerous driving, and misconduct. Victim recounts lack of help during assaults. This case reveals broader issues within the Hong Kong police force, highlighting challenges citizens face daily. Trial continues. #HongKong#PoliceMisconduct#LegalProceedings"
Germany: Regional Court Suspects AI-Driven Mass Lawsuits
Hello everyone! The Regional Court of Frankfurt suspects that law firms are using artificial intelligence for orchestrating mass lawsuits. District Court President Wilhelm Wolf sheds light on the matter, revealing a rising trend of "mass proceedings" inundating the legal system.
Law firms are suspected of leveraging AI to attract large cohorts of plaintiffs for minor claims, such as flight delays, gambling winnings, or bank charges.
The courts are grappling with an influx of strikingly similar cases, hinting at systematic efforts to generate substantial revenue with minimal effort.
District Court President Wolf posits this as a potential business model, where technical procedures identify similar cases, and law firms offer representation en masse.
This revelation underscores the evolving dynamics between AI and the legal landscape, prompting a closer examination of the intersection between technology and mass legal actions.
#AILaw#LegalTech#AIinLaw#MassLawsuits#LegalProceedings