В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
⚠️🇺🇸NEXT GENERATION GOP COULD BE MORE EXTREME THAN MAGA — WASHINGTON POST
🔹 Young white nationalists like Nick Fuentes infiltrating mainstream Republican circles 📱
🔹 Groypers movement gaining influence: antisemitic, nativist, racist ideology spreading 🚩
🔹 Iran war could be breaking point that expands their power within the party 🌍
🔹 Pattern repeats: Tea Party was more extreme than Gingrich era, now this generation tops MAGA 📈
🔹 Even Marjorie Taylor Greene broke with Trump over Iran threats as "madness" ⚡
One GOP insider warns: "Trump opened the door for this next generation to take over." The party's rightward spiral shows no signs of stopping! 😬🔥
#Republican#MAGA
@america
October 12, 2021: Texas Governor, San Diego crash, U.S. Navy, Indigenous Peoples' Day, Afghanistan
October 12, 2021: Texas Governor, San Diego crash, U.S. Navy, Indigenous Peoples' Day, Afghanistan
1. Republican Texas Governor Greg Abbott, responding to what he called "bullying" by the Biden Administration, barred all COVID-19 vaccine mandates in the state by any entity, including private employers.
2. A small aircraft crashed blocks from a high school campus near San Diego, killing at least two people and injuring two others, while also destroying homes, officials and local media said.
3. Former U.S. Navy nuclear engineer and his wife are scheduled to face their first court hearing on charges they attempted to sell secrets about nuclear submarines to a foreign power in exchange for cryptocurrency.
4. Christopher Columbus Day drew crowds with U.S. city parades marking the explorer's voyage and Italian-American culture, as the focus increasingly turned to the heritage and plight of indigenous people subjugated by European settlers.
5. Afghanistan's foreign minister appealed to the world for good relations but avoided making firm commitments on girls' education despite international demands to allow all Afghan children to go back to school.
#TexasGovernor
#GregAbbot
#Republican
#Covid19
#Biden
#SanDiego
#Aircraftcrash
#UnitedStates
#Navy
#Cryptocurrency
#ChristopherColumbusDay
#Parades
#Afghanistan
#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➖