В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Municipal elections are underway in Venezuela to renew 335 mayoral seats and 2,471 local council posts.
Venezuelanalysis' Andreína Chávez files this report from the Libertador municipality in Caracas.
#MunicipalElections#Venezuela#LocalPolitics
📷 NEWS | Chavismo and Opposition Urge Voters to Participate in Final Campaign Push Ahead of Municipal Elections
On Sunday, Venezuelans will elect 335 mayors and 2,471 municipal councillors. The vote marks the culmination of Venezuela’s electoral cycle, following last year’s presidential election and the recent legislative and regional races, both of which yielded favourable outcomes for the ruling United Socialist Party (PSUV) and allied organizations.
Chavismo and opposition candidates wrapped up the 14-day campaign on Thursday with large rallies nationwide. Currently, two-thirds of the country's 335 municipalities are under Socialist control, while opposition factions hold over 100 mayoralties.
Read our report (+photos): https://venezuelanalysis.com/images/chavismo-and-opposition-urge-voters-to-participate-in-final-campaign-push-ahead-of-municipal-elections/
#MunicipalElections#Chavismo#Opposition#Venezuela
📝 INTERVIEW | Building Communal Power from the Mayor’s Office: A Conversation with Lisbed Carolina Parada
With municipal elections scheduled for Sunday, July 27, VA interviewed Lisbed Carolina Parada, mayoral candidate in the town of Urachiche, Yaracuy state.
A longtime communal activist, Parada discussed the need to put institutional spaces at the service of popular power in the territories.
Follow the link to read the interview: https://venezuelanalysis.com/interviews/building-communal-power-from-the-mayors-office-a-conversation-with-lisbed-carolina-parada/
#MunicipalElections#PopularPower#Urachiche#Communes