В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
[Sent by Gov.sg – 17 Feb]
SG Clean
- COVID-19 is transmitted primarily through droplets. To fight this outbreak, we need to look after our personal hygiene, AND keep Singapore clean.
- A clean environment will help stop community transmission of COVID-19
7 good habits
1. Keep premises clean and pest-free
2. Return trays, keep tables clean
3. Keep toilets clean and dry
4. Wash hands regularly with soap
5. Take temperature, see doctor if unwell, stay home
6. Use tissue when sneezing or coughing
7. Bin litter and soiled tissue
NEA stepping up:
- Inspection of public toilets and other public places
- Enforcement against spitting and littering
- Adoption of SG Clean quality mark, to ensure high level of cleanliness
More on #SGClean: go.gov.sg/sgclean
More hygiene tips: go.gov.sg/getserious
More than 5,000 premises have been certified #SGClean since the campaign launch on 16 Feb 2020!
But what does this mean? Premises with the SG Clean quality mark have high levels of cleaning and hygiene standards. Go to sgclean.gov.sg for a list of places that are certified SG Clean.
#DidYouKnow that Chomp Chomp Food Centre’s unique name originated from its Teochew name, Tiong Tiong, which means loyalty and righteousness?
If you’ve visited Chomp Chomp recently, you may have seen the SG Clean quality mark signalling the hawker centre’s high level of cleaning and hygiene standards. The full list of certified SG Clean places is available at sgclean.gov.sg
#SGClean#OurHawkerCentres
Are we practising #GoodHygieneHabits when we’re out and about? From washing our hands regularly to using a serving spoon and avoiding double-dipping, let’s not forget these practices when dining with family and friends. #SGClean
Meet our SG Clean Ambassadors! Sharing a common passion to make #SGClean a way of life, our #SGCleanAmbassadors will help drive the adoption of good personal habits and social norms.
They will encourage patrons to return their trays and keep tables clean, and guide them on safe distancing measures to #FightCOVID19 and other infectious diseases. Interested to join the SG Clean Ambassadors Network? Sign up at http://go.gov.sg/sgcleanambassadors
“We are the first line of defence in ensuring that our patrons dine with peace of mind. We have intensified our cleaning efforts to ensure the cleanliness of the toilets, food trays, cutlery, tables and chairs. One major change to our daily work is the use of four different cloths, each for a different purpose. With these enhanced measures, we hope to reassure the public and encourage them to continue dining here.” – Mr Deji Pravin, Nick Cleaning Services Pte Ltd, Hawker Centre @ Our Tampines Hub
#FightCOVID19#SGClean#SGUnited#SingaporeTogether
Heading out for lunch at your favourite hawker centre, coffeeshop or food court? Remember to put your used tissues where they belong! #BinUsedTissue#CleanYourTable#SGClean
We are all looking forward to dining in again at our favourite places. Let’s not forget good dining habits at #OurHawkerCentres to mitigate the spread of COVID-19! #BinOurTissues & #ReturnOurTrays, to keep the table clean for the next user and reduce the risk of disease transmission to cleaners and other members of the public. Eat from your tray, and don’t leave behind soiled tissues or wet wipes on dining tables. #FightCOVID19#SGClean
We continue to press on in the fight against the COVID-19! NEA has been providing guidance to operators of food establishments, including stallholders at #OurHawkerCentres, to maintain high standards of hygiene and cleanliness to safeguard public health.
You can do your part by practising the 7 Habits of Good Public Hygiene! Together we can overcome!
#FightCOVID19#SGClean#SingaporeTogether#SGUnited
https://youtu.be/t19szcAGw-U
Don’t leave your used tissues or wet wipes behind when dining at #OurHawkerCentres! It is important to dispose of used tissues or wet wipes which can be highly contaminated, to #FightCOVID19, especially as we resume our activities gradually.
From 19 Jun when dining-in resumes, Safe Distancing Ambassadors at hawker centres and coffeeshops will be on hand to remind patrons to be socially responsible and observe personal hygiene. Let’s all do our part to keep ourselves and those around us safe. https://go.gov.sg/nea17jun20-hygieneathcs-toilets
#BinOurTissues#ReturnOurTrays#SGClean#KeepSGClean