В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🚀 Introducing the ultimate beast on wheels - Xiaomi's SU7 Ultra! With a whopping 1548 horsepower from its three electric motors, this sedan accelerates from 0 to 100 km/h in just 1.97 seconds and hits 200 km/h in 5.96 seconds. It boasts a top speed exceeding 350 km/h! 🏎️
#Xiaomi#SU7Ultra#SpeedDemon#ElectricPower#NurburgringRecordBreaker🏁🔥
🚗✨ Get Ready for the Modern Audi Sport Quattro! ✨🚗
On August 16th, the highly anticipated modern replica of the iconic Audi Sport Quattro will be unveiled live! 🎉🔥
Announced three years ago, this stunning electric powerhouse from German startup E-Legend boasts an impressive 816 horsepower!⚡💪 With only 30 units planned for production, this exclusive ride is set to turn heads! 😍
#AudiSportQuattro#ELegend#ElectricPower#CarEnthusiast#Supercar#ComingSoon#Auto
🚗💨 Exciting news from Lamborghini! The upcoming Lamborghini Temerario is set to unleash over 1000 horsepower! 🔥
Ruwen Mor, a former Audi engineer now at Lamborghini, revealed that the power of the V8 engine could increase from 200 to around 220 hp per liter. Plus, the car will feature three electric motors for an extra boost! ⚡️
The Temerario follows in the footsteps of the iconic Huracan, which had a naturally aspirated V10 engine with a peak output of 640 hp. While a V6 could have delivered even more power, the decision was made to stick with a higher cylinder count to meet customer expectations. 💪
#Lamborghini#Temerario#Supercar#1000HP#V8#ElectricPower#CarEnthusiast#LuxuryCars#Auto
🚗✨ Introducing the all-new Bentley Flying Spur! ✨🚗
The fourth generation of this iconic sedan has arrived, and it’s not just a pretty face. With a stunning Ultra Performance Hybrid powertrain, it’s now the most powerful four-door Bentley in history! 💪🔋
🔧Power Specs:
- 4.0L Twin-Turbo V8 + Electric Motor
- 782 hp & 1000 Nm of torque 💥
- 0 to 100 km/h in just 3.5 seconds⏱️
- Up to 76 km on electric power alone! ⚡
#Bentley#FlyingSpur#LuxuryCars#HybridPerformance#CarEnthusiast#Innovation#LuxuryLifestyle#ElectricPower#Auto
🚀 France Shifts Focus to Electric Power Amid Rising Oil Prices
French Prime Minister Sebastien Lecornu announced a strategic shift in government policy, emphasizing investment in electric power over short-term fuel aid. Bloomberg posted on X that this decision comes in response to the recent surge in oil prices triggered by the conflict in Iran. Lecornu highlighted the importance of supporting households and businesses in transitioning to electric power as a sustainable solution to the energy crisis. The government aims to reduce dependency on fossil fuels and promote cleaner energy alternatives. This move is part of a broader effort to address the economic impact of rising oil prices and ensure long-term energy security for the nation.
#France#ElectricPower#OilPrices#EnergyTransition#RenewableEnergy#EnergyPolicy#SustainableEnergy#FossilFuelReduction#EnergySecurity#EconomicImpact
Bitwise Launching Bitcoin Standards ETF
Bitwise is set to launch the Bitcoin Standard Company ETF, targeting companies with substantial Bitcoin holdings. Criteria include: holding at least 1,000 Bitcoins, market cap over $100 million, daily liquidity of $1 million+, and a public float of at least 10%. Read more
In Ethiopia, Bitcoin mining fueled by the Grand Renaissance Dam contributes 18% of the Ethiopian Electric Power Company's revenue. Recent investments in mining have topped $1 billion, with the government partnering with 25 companies to leverage low electricity costs of about 3.2 cents/kWh. Read more
#Bitcoin#ETF#Mining#Ethiopia#Electricity#Crypto#Investment#GerD#Revenue#Bitwise#Blockchain#Finance#CorporateReserves#Energy#MarketValue#Liquidity#PublicFloat#Africa#Partnership#InternationalMiners#ElectricPower