В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Tuscany, #Italy
Tuscany is the birthplace of the Italian language. Tuscany was a very important cultural and historical center. She had a significant impact on the social and artistic development of Europe and the whole world.
Burano Island, Venice, #Italy
In order not to get lost in the thick fog and find their way home, the residents of Burano painted their houses in very bright colors. Later, such a need disappeared, but the tradition remained. Today, the coloring of houses is regulated by the municipality. Residents can only paint their houses according to the permitted palette.
Milan Cathedral, #Italy
The main Cathedral of Milan (Duomo di Milano) - The Duomo or Cathedral of the Nativity of the Virgin Mary was built for more than 500 years. Construction began in the 14th century and ended in the early 19th century, with the last door of the temple being installed in 1965.
Sardinia, #Italy🇮🇹
Sardinia has a law prohibiting the export of sand and pebbles from the island.
The most traditional dish in Sardinia is Fregola pasta, made from a paste of unusual shape, served with tomato sauce and an abundance of seafood.
One of the favorite delicacies of Sardinians is sea urchins.
Loreto Island, #Italy
Due to the small number of documents that have survived to this day, little is known about the island's past, until 1910, when Cavalier Vincenzo Ricchieri decided to build a neo-Gothic castle here, which today is a private residence.
Dolomites, #Italy
The Dolomites are often called the Prealps, the beginning of the Alps, although these mountains are not very high. There are 18 peaks with a height of more than 3 thousand meters, and in some places there is even snow in summer.
Umbria, #Italy🇮🇹
From the windows of Castello-Di-Rocko Castle-now a hotel with 36 Syuts, a restaurant and an underground spa-and residences views of neat rows of vineyards and cypress alleys.
For almost 30 years, the Bolz family managed to return the thousand -year castle to life, but there are still many work ahead of their own admission. The immediate plans are to open a second restaurant in the territory, but this is only another, not the last step.
「🌺」#italy
The sightseeing did not end there. For the next couple of days we kept exploring Florence. Thanks to our wonderful professor almost everyday we had field trip to some gallery or museum with guides who told us about the history of Florence and more. For the rest of the time we explored on our own, went to popular affogato place, to bookstore with cinema inside and golden bridge where we watched sunset (it was the best place imo).
The art galleries and museums in Florence are PACKED! Overall we went to Villa la Pietra (which is the villa owned by NYU💅), Pitti Palace and Boboli Gardens, The Uffizi Gallery, Gucci Museum, and last but not least Ferragamo Museum.
The one I enjoyed the most was Pitti Palace and Boboli Gardens AND Ferragamo Museum. More about them in upcoming posts...
All those times the weather was rainy and sometimes sunny, it changes so fast.
Sometimes you can catch musicians performing in the middle of the streets just like we did. It is so fascinating honestly.
~🍋~
↬@jastm1🌊
「🌺」#italy
Firenze – First Couple of Days 🇮🇹
We arrived on campus and were immediately blown away by its beauty and grandeur. It wasn’t just beautiful it was absolutely massive. Everywhere we looked, there were tall trees and old sculptures, all perfectly blended into the landscape.
We had a mini tour of the campus followed by a quick walk through the city center. I was honestly too stunned to speak, everything was just so incredible 🥲.
Then came the food: we had what might have been the best pizza ever. It was seriously THAT good. And of course, we had gelato at local spot. Little did we know … it was not even the best gelato in town!
Exhausted but happy, we called it a night. Wait for next part. ✨
~🍋~
↬@jastm1🌊
「🌺」#italy
We also tried affogato at one of the oldest places in Florence! Under the rain it was really nice to have hot espresso with vanilla ice cream🥰. I really want to come back here with my family, I am kind of feeling guilty for experiencing all of this by myself only 😭🙏.
~🍋~
↬@jastm1🌊
「🌺」#italy
It is a bit hard to find halal food cause sometimes they even add alcohol in food with only veggies so you need to be careful. Guess we are vegetarians in Italy 😄🤩
Tomato,basil and cheese combo is SOO good tho!
~🍋~
↬@jastm1🌊
「🌺」#italy
Architecture in Italy is crazy just like in every other city in Europe!
You can just take a random picture and it would be so aesthetic. The only thing is that we were warned to be aware of our bags and overall to stay alert and walk in groups🥲🚨
~🍋~
↬@jastm1🌊