В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
#DasturlashHayoti#LearnToCode#Programmer
Har bir dasturchi bilishi kerak bo‘lgan 5 ta bepul manba
🆓Pul to‘lamasdan bilim olishning eng zo‘r manbalari:
1️⃣FreeCodeCamp — front-end’dan tortib back-end’gacha
2️⃣roadmap.sh — qaysi yo‘nalishdan boshlashni aniq ko‘rsatadi
3️⃣Frontend Mentor — haqiqiy dizayn asosida kod yozish mashqi
4️⃣CSS Battle — o‘yin orqali CSS o‘rganasiz
5️⃣DevDocs — barcha texnologiyalar hujjatlari bitta joyda
Bilim — eng yaxshi investitsiya. Ayniqsa, pulsiz bo‘lsa yanada yoqimli 😄
Shunaqa postlar davom etsin desangiz, ulashib qo‘ying — birga o‘rganamiz! 💪
💻@dasturlash_hayoti— Dasturchilar uchun eng kerakli maslahatlar va foydali kontent
#SpringBoot#RESTAPI#BackendDevelopment#CodeWithMosh#Java#StripeIntegration#CloudDeployment#LearnToCode
🚀 Ready to take your backend skills to the next level?
🔗Spring Boot: Mastering REST API Development🎓
- Learn to build clean, secure RESTful APIs
- Add authentication, role-based access, and JWT security 🔒
- Integrate Stripe for real payment processing 💳
- Deploy your app and database to the cloud ☁️
- Apply industry best practices for production-ready code 🛠
👉 Join now @repo_science and start building real-world projects like a pro!
YES! 🙌 It's a wrap! 🥳
The HaraCoders Bootcamp training, brought to you by the awesome Rotaract Club of Kuriftu 🤝, BuildX Ethiopia , Sira Ale, and Addis Ababa University College of Veterinary Medicine and Agriculture , has been a HUGE success!
We're sending out waves of gratitude to everyone involved and a BIG congrats to our fantastic trainees! 🎉
So proud of you all! 🔥
Stay tuned... round 2 might be closer than you think! 😉🚀
#AddisCoders#BuildXEthiopia#TechForAll#EmpowerTheFuture#CodingBootCamp#EthiopianTech#LearnToCode#CodingForChange
#Rotary
#Rackuriftu
#100yearsofserviceinafrica
#Rotaract
#District9212
#RotaractEthiopia
🚀 Exciting News! 🚀
The AddisCoders BootCamp is brought to you by BuildX Ethiopia in partnership with Rotaract Kuriftu, SERRALE, and Addis Ababa University! 🎓💻
Together, we’re empowering Ethiopian youth with hands-on web development skills to build the future of tech! 🔥
Stay tuned for more updates!
#AddisCoders#BuildXEthiopia#TechForAll#EmpowerTheFuture#CodingBootCamp#EthiopianTech#LearnToCode#CodingForChange
#Rotary
#Rackuriftu
#100yearsofserviceinafrica
#Rotaract
#District9212
#RotaractEthiopia