В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
#newtgingrich : RT @RealAmVoice: "It is very clear that Putin has made a gamble — which is the gamble probably of his life."
@NewtGingrich joins the War Room to break down the cyber attacks and China displacing the United States.
Watch more War Room with #SteveBannon here: https://t.co/No6fL5Gjrqhttps://t.co/IqpJjfrwIf
Economic war with Russia on the horizon?
Steve Bannon:
“You’ve now got a major economic war that is going to kick up with Russia. They just put out the word. They said ‘Hey […] if you touch the $300 billion that you stole from us, each country that does it is going to answer to us personally.’ […] This is something we didn’t do to the Nazis, something we didn’t do to Imperial Japan… We gotta be very careful. Everybody is treading on thin ice on this one.”
#SteveBannon#Russia#war
👂More on Trump's Ear ⚠️
According to Steve Bannon, the United Kingdom is on the brink of civil war. Its leaders have allowed the country to be taken over, its institutions of power have been hollowed out, and those who resist are being punished. This is a battle for Western civilization.
This is why Donald Trump is not in London — because there are huge riots down there.
#SteveBannon#UK#civilwar
👂More on Trump's Ear ⚠️
January 6 panel moves to hold Steve Bannon in contempt
A U.S. congressional committee probing the deadly Jan. 6 assault on the Capitol said it would vote next week to hold Steve Bannon, a longtime adviser to former President Donald Trump, in contempt of Congress for refusing to comply with a subpoena.
#January6#Trump#SteveBannon#News#Reuters
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
October 15, 2021: Bill Clinton, Steve Bannon, FDA Moderna booster, Texas abortion law, Immigration
Top headlines on October 15, 2021: Bill Clinton in hospital, Steve Bannon, FDA Moderna booster, Texas abortion law, Biden's immigration plans
1. Ex-President Bill Clinton is recovering in hospital after being treated ‘for a non-COVID-19 infection.’ The 75-year-old was admitted on Tuesday evening.
2. A panel probing the U.S. Capitol assault will vote to hold Steve Bannon in contempt of Congress after the Trump advisor refused to comply with a subpoena.
3. U.S. FDA advisers voted in favor of booster shots of the Moderna vaccine for Americans aged 65+ and those at high risk of illness.
A U.S. appeals court rulesd to keep a Texas abortion ban in effect. The law bars the procedure as early as six weeks into pregnancy.
5. U.S. President Joe Biden's administration will restart Trump’s ‘Remain in Mexico’ policy by mid-November. The program forces asylum seekers to wait in Mexico for U.S. court hearings
#FDA
#COVID19
#USBorder
#Texas
#abortion
#SteveBannon
#CapitolRiot
#BillClinton
#Clinton
#Moderna
#Vaccine
#Booster
#US
#Mexico
#Migrants
#Biden
#UnitedStates
#Trump
#News
#Reuters
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖