В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
Green University hosted an official meeting between the Rector and students on the occasion of “Youth Day.”
🗣During the event, the Rector of Green University, Dr. Bakhtiyor Pulatov, spoke about the conditions created for students, ongoing efforts to further enhance the quality of education, and future plans aimed at supporting young people. Students’ proposals and initiatives were also heard, and practical measures for their implementation were discussed.
💬The meeting was attended by a representative of the Youth Affairs Agency of the Republic of Uzbekistan, Elyor Norpulatov, who provided detailed information on the priority directions of the state youth policy and the opportunities being created for young people.
The participants also discussed the content of the meeting between President Shavkat Mirziyoyev and youth, as well as the key priorities outlined during that dialogue, exchanging views on their effective implementation within the activities of higher education institutions.
👉ReadMore
#YouthDay#OpenDialogue
_____________________
Green University’da “Yoshlar kuni” munosabati bilan rektor va talabalar ishtirokida rasmiy uchrashuv bo‘lib o‘tdi.
🗣Tadbir davomida Green University rektori Professor Baxtiyor Pulatov talabalarga yaratilgan shart-sharoitlar, ta’lim sifatini yanada oshirish, yoshlarni qo‘llab-quvvatlashga qaratilgan istiqboldagi rejalar haqida so‘z yuritdi. Shuningdek, talabalar tomonidan bildirilgan taklif va tashabbuslar tinglanib, ularni amaliy qo‘llab-quvvatlash masalalari muhokama qilindi.
💬Uchrashuvda O‘zbekiston Respublikasi Yoshlar ishlari agentligi vakili Elyor Norpulatov ham ishtirok etib, yoshlarga oid davlat siyosatining ustuvor yo‘nalishlari hamda yaratilayotgan imkoniyatlar haqida ma’lumot berdi.
Shuningdek, tadbir davomida President Shavkat Mirziyoyevning yoshlar bilan o‘tkazgan uchrashuvi mazmuni va unda belgilab berilgan ustuvor vazifalar muhokama qilinib, ularning ta’lim muassasalari faoliyatida samarali amalga oshirilishi yuzasidan fikr almashildi.
👉Batafsil
#YoshlarKuni#OchiqMuloqot
✉️[email protected]
☎️ +998 55 512 00 77
📍Location
🌐Website | 📱Telegram | 📱Instagram | 📱LinkedIn | 🟥YouTube