В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🇨🇷#CostaRica – La candidata populista di destra Laura #Fernández Delgado vince le elezioni presidenziali con il 48% dei voti. Politologa, 39 anni, vicina al presidente Rodrigo #Chaves ed ex ministra della Pianificazione Nazionale e della Politica Economica, ha promesso una linea dura contro la criminalità sul modello del presidente salvadoregno Bukele. Il suo partito, il Partito Popolare Sovrano (#PPSO), ha ottenuto la maggioranza in Parlamento, mentre il candidato presidente di centrosinistra Álvaro #Ramos si ferma al 33%. Affluenza al 70%.
@UltimoraPolitics24
Costa Rica: Laura Fernández Has Won Presidential Election
The rightwing populist Laura Fernández has won Costa Rica’s presidential election in a landslide after promising to crack down on rising violence linked to the cocaine trade.
Fernández’s nearest rival, centre-right economist Álvaro Ramos, conceded defeat as results showed the ruling party far exceeding the threshold of 40% needed to avoid a runoff.
With 94% of polling stations counted, the political heir of outgoing president, Rodrigo Chaves, had captured 48.3% of the vote, compared with Ramos’s 33.4%, according to the Supreme Electoral Tribunal (TSE).
As soon as the first results were announced, members of Fernández’s Sovereign People’s party erupted in celebrations around the country, waving blue, red and white-striped Costa Rican flags. “Viva Rodrigo Chaves,” some cheered, in a nod to Fernández’s mentor.
Appearing via video link at her party’s official election night gathering in the capital San Jose, Fernández, 39, thanked Chaves for giving her “the confidence to be president-elect of Costa Rica” and said his legacy was in good hands.
Fernández cites the iron-fisted Salvadoran president Nayib Bukele, who has locked up thousands of suspected gang members without charge, as an inspiration on how to tackle crime. Bukele was the first foreign leader to congratulate her.
Chaves plucked Fernández from relative anonymity to serve as planning minister and chief of staff. In a conversation with her on Sunday night, Chaves said he was confident that under her leadership “there will be neither dictatorship, nor communism”.
Chaves presided over a sharp rise in violence but avoided blame by pointing the finger at the judiciary, saying it was too soft on crime.
Jessica Salgado, 27, said she voted for Fernández as the continuity candidate, because she felt the government was on the right track, even if violence had increased.
“The violence exploded because they [the government] are going after the ringleaders, it’s like dragging rats out of the sewer,” Salgado told AFP.
The former president Óscar Arias, winner of the 1987 Nobel peace prize, warned on Sunday that the “survival of democracy” was at stake.
“The first thing dictators want to do is to reform the constitution to stay in power,” he said, alluding to Chaves.
#costa#rica#fernández#presidential#election
📱American Оbserver - Stay up to date on all important events
🇺🇸