В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🌎 Trapped in an Andes avalanche in 1972, survivors of a plane crash endured 72 days in freezing mountains, rationing food and melting snow for water—proving human resilience in the harshest conditions. ✨
#survival⚡#history⚡#resilience
👉subscribe Interesting Planet
🌎 The Resurrection Fern can survive months or years without rain by curling up and looking dead. With just a splash of water, it springs back to vibrant green life, showcasing an extraordinary natural survival trick for drought-prone environments. ✨
#plants⚡#adaptation⚡#resilience
👉subscribe Interesting Planet
🌍 Some coral reefs in the Red Sea host unique fish and coral species that can tolerate extreme heat and high salt levels, making them among the most resilient reef ecosystems on Earth. ✨
#coral⚡#marine⚡#resilience⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography🌍
Ad Al-Wafa, a Gaza, questa settimana si è celebrata la cerimonia di fine anno scolastico per migliaia di bambini.
Un evento che in condizioni normali sarebbe stato occasione di festa ma che si è trasformato in un momento intriso di dolore. I volti dei piccoli brillavano d’orgoglio mentre ricevevano i diplomi ma dietro ai sorrisi si nascondeva un vuoto profondo: nessun genitore ad applaudirli, nessuno a scattare foto o a sussurrare parole di incoraggiamento.
Un rapporto dell’ONU rivela che oltre il 90 % delle scuole e università sono state danneggiate o distrutte, privando dell’istruzione più di 800.000 bambini e ragazzi e interrompendo la vita accademica di circa 90.000 universitari. Oggi tutti questi ragazzi studiano in tende di fortuna gestire da Unicef, ONU E UNRWA continuamente bersagliate dall’artiglieria di Israele.
#gazagenocide#gazastudents#resilience
🌎 Trapped under debris for 17 days after a 2015 Nepal earthquake, Pemba Tamang survived by drinking muddy water dripping from rubble and eating small snacks. He emerged with only minor injuries after nearly 2½ weeks underground, making it one of the longest earthquake survival cases recorded. ✨
#survival⚡#earthquake⚡#resilience
👉subscribe Interesting Planet
👉more Channels
🌎 The tardigrade’s cousin, the rotifer, can survive drying out for decades by entering a state called cryptobiosis. When water returns, it wakes up as if nothing happened, showing remarkable resilience in the micro-world. ✨
#rotifer⚡#cryptobiosis⚡#resilience
👉subscribe Interesting Planet
As the 60-day ceasefire deadline ended, the people of southern #Lebanon returned to their homes despite Israeli violence. 15 martyrs and 83 injured in the ongoing struggle for their land.
#DayOfReturn#CeasefireDeadline#Resilience#Israel#SouthernLebanon#Occupation
After over a year of displacement, the people of southern #Lebanon return—not to homes, but to the land scarred by Israeli aggression. Their spirit is unbroken.
#Resilience#SouthernLebanon#ReclaimingHome#Rebuilding#Israel#LebaneseArmy
🚀 South Korea's Central Bank Governor: Export Performance Exceeds Expectations
South Korea's central bank governor, Lee Chang-yong, has stated that the country's export performance has surpassed expectations. According to Jin10, Lee highlighted the positive export figures during a recent address, noting that the results are better than initially anticipated. This development comes amid ongoing global economic challenges, where South Korea's export sector has shown resilience and adaptability. The improved export performance is seen as a crucial factor in supporting the nation's economic stability and growth. Lee's remarks underscore the importance of exports in South Korea's economic strategy, as the country continues to navigate complex international trade dynamics.
#SouthKorea#CentralBank#ExportPerformance#EconomicGrowth#GlobalEconomy#Resilience#TradeDynamics#LeeChangYong#EconomicStability
When kids have big emotions, we tend to think they are being overly sensitive, that they need more resilience. Most of the time it is because there is a lot happening for the child that we can't see and don't know, that is pushing them beyond their means of coping. Instead we can change the response from they are overreacting, to seeing a child who has a lot happen for them, they are doing the best they can. They need our help not judgement.
#parenting#positiveparenting#gentleparenting#resilience#respectfulparenting#psychologist#play#playtherapy#childdevelopment#childtherapy#parentingtips#teachers#asd#family#life#adhd#mumlife#momlife#dads#consciousparenting
https://www.instagram.com/p/Ctd93W8vEM9/