В прошлом посте говоря "Все вызовы теперь одинаковы" я несколько слукавил. Всё-таки есть в этом зоопарке версий некоторая несовместимость вызов которой просто так не унифицировать. Эти моменты вынесены в отдельный модуль 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
🌎 The phenomenon of synesthesia allows some people to experience a blending of senses—like seeing colors when hearing music or tasting flavors from words. This rare trait reveals how flexible and interconnected the human brain’s sensory pathways can be. ✨
#neuroscience⚡#consciousness⚡#perception
👉subscribe Interesting Planet
🌎 Marathon runners often report “time expansion,” where minutes can feel much longer during intense effort. This phenomenon is linked to changes in dopamine levels in the brain, affecting how we sense passing seconds. Scientists have tracked measurable shifts in perceived time during both high physical exertion and tasks demanding intense attention. ✨
#time⚡#neuroscience⚡#perception
👉subscribe Interesting Planet
👉more Channels
🌎 Time can seem to slow down or speed up based on emotional state. Studies show heightened fear, such as during accidents, leads people to recall more detail, but does not actually slow objective time. Experiments reveal our brain may stretch memory to make intense events feel longer, a phenomenon called time dilation. ✨
#neuroscience⚡#perception⚡#psychology
👉subscribe Interesting Planet
👉more Channels
🌎 The phenomenon of "temporal binding" describes how the brain knits together events that happen closely in time, making them feel like a single, unified event. Studies show people often judge actions and their effects as happening closer together than they really are, revealing how the human mind shapes our perception of time’s flow. ✨
#neuroscience⚡#psychology⚡#perception
👉subscribe Interesting Planet
👉more Channels
🌎 Time perception can be dramatically altered by body temperature, with research showing people exposed to cold environments often overestimate how much time has passed. This effect is linked to changes in the brain’s internal clock, and studies found that participants in cold water estimated intervals were about 20% longer than in neutral conditions. ✨
#neuroscience⚡#psychology⚡#perception
👉subscribe Interesting Planet
👉more Channels
🌎 Time can feel stretchy in our minds! In moments of stress or fear, your brain’s perception of time slows down—an effect called “time dilation.” The brain records more details during intense experiences, making events seem to last longer in memory. That’s why scary or thrilling moments feel like they stretch on forever, even though the real clock keeps ticking at its usual pace. ✨
#neuroscience⚡#psychology⚡#perception
👉subscribe Interesting Planet
🌎 Your sense of time can shift dramatically—scientists call these “time anomalies.” Strong emotions or new environments can make minutes feel like hours, or hours like seconds. This happens because your brain judges time based on how much information it’s processing, not by the clock. Moments packed with novelty or excitement seem longer, while routine days fly by unnoticed. ✨
#psychology⚡#perception⚡#brain
👉subscribe Interesting Planet
🌎 The phenomenon known as synesthesia causes some people to involuntarily link senses, such as perceiving numbers or letters as specific colors. Brain scans show increased cross-activity between sensory regions in synesthetes, and the trait is estimated to occur in about 4% of people. ✨
#neuroscience⚡#perception⚡#senses
👉subscribe Interesting Planet
👉more Channels
🌎 Our sense of time is shaped by specialized brain regions, including the cerebellum, basal ganglia, and the right supplementary motor area. Research using brain imaging and patient studies shows damage to these areas can create time perception anomalies—such as feeling time stretch, shrink, or fragment unexpectedly. The cerebellum, once thought only to control movement, plays a key role in accurately judging short time intervals. ✨
#neuroscience⚡#perception⚡#anomalies
👉subscribe Interesting Planet
👉more Channels
🌎 In rare cases, time perception can be distorted by neurological conditions such as temporal lobe epilepsy or brain injuries. People may report "time slowing down," déjà vu, or missing chunks of experience. Some individuals with temporal lobe seizures even describe feeling like time has stopped completely. ✨
#neuroscience⚡#perception⚡#anomalies
👉subscribe Interesting Planet
🌎 Your brain uses a region called the "suprachiasmatic nucleus" as its master clock, syncing your sense of time to light and dark cycles. Disruptions—like jet lag or shift work—can make time feel faster or slower, and this clock influences sleep, alertness, and body temperature rhythms. ✨
#perception⚡#neuroscience⚡#circadian
👉subscribe Interesting Planet
👉more Channels
🌎 Certain types of migraine can cause "time dilation" or "time compression"—making minutes feel like hours or vice versa. Research links these time perception anomalies to abnormal brain activity in areas responsible for processing time and sensory input. Migraine auras affecting time sense have been documented in up to 15% of patients. ✨
#migraine⚡#neuroscience⚡#perception
👉subscribe Interesting Planet
👉more Channels