Python PyQt5.QtCore.QEvent() Examples

The following are 16 code examples for showing how to use PyQt5.QtCore.QEvent(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtCore , or try the search function .

Example 1
Project: track   Author: frans-fuerst   File: mainwindow.py    License: Apache License 2.0 7 votes vote down vote up
def event(self, e):
        if not isinstance(e, (
                QtCore.QEvent,
                QtCore.QChildEvent,
                QtCore.QDynamicPropertyChangeEvent,
                QtGui.QPaintEvent,
                QtGui.QHoverEvent,
                QtGui.QMoveEvent,
                QtGui.QEnterEvent,
                QtGui.QResizeEvent,
                QtGui.QShowEvent,
                QtGui.QPlatformSurfaceEvent,
                QtGui.QWindowStateChangeEvent,
                QtGui.QKeyEvent,
                QtGui.QWheelEvent,
                QtGui.QMouseEvent,
                QtGui.QFocusEvent,
                QtGui.QHelpEvent,
                QtGui.QHideEvent,
                QtGui.QCloseEvent,
                QtGui.QInputMethodQueryEvent,
                QtGui.QContextMenuEvent,
                )):
            log().warning("unknown event: %r %r", e.type(), e)
        return super().event(e) 
Example 2
Project: qutebrowser   Author: qutebrowser   File: debug.py    License: GNU General Public License v3.0 5 votes vote down vote up
def log_events(klass: typing.Type) -> typing.Type:
    """Class decorator to log Qt events."""
    old_event = klass.event

    @functools.wraps(old_event)
    def new_event(self: typing.Any, e: QEvent) -> bool:
        """Wrapper for event() which logs events."""
        log.misc.debug("Event in {}: {}".format(utils.qualname(klass),
                                                qenum_key(QEvent, e.type())))
        return old_event(self, e)

    klass.event = new_event
    return klass 
Example 3
Project: eddy   Author: danielepantaleone   File: palette.py    License: GNU General Public License v3.0 5 votes vote down vote up
def eventFilter(self, source, event):
        """
        Filters events if this object has been installed as an event filter for the watched object.
        :type source: QObject
        :type event: QtCore.QEvent
        :rtype: bool
        """
        if event.type() == QtCore.QEvent.Resize:
            widget = source.widget()
            widget.redraw()
        return super().eventFilter(source, event)

    #############################################
    #   SLOTS
    ################################# 
Example 4
Project: eddy   Author: danielepantaleone   File: palette.py    License: GNU General Public License v3.0 5 votes vote down vote up
def eventFilter(self, source, event):
        """
        Filters events if this object has been installed as an event filter for the watched object.
        :type source: QObject
        :type event: QtCore.QEvent
        :rtype: bool
        """
        if event.type() in {QtCore.QEvent.MouseButtonPress, QtCore.QEvent.MouseButtonRelease, QtCore.QEvent.MouseMove}:
            if isinstance(source, PaletteButton):
                if not self.isEnabled():
                    return True
        return super().eventFilter(source, event) 
Example 5
Project: eddy   Author: danielepantaleone   File: info.py    License: GNU General Public License v3.0 5 votes vote down vote up
def eventFilter(self, source, event):
        """
        Filters events if this object has been installed as an event filter for the watched object.
        :type source: QObject
        :type event: QtCore.QEvent
        :rtype: bool
        """
        if event.type() == QtCore.QEvent.Resize:
            widget = source.widget()
            widget.redraw()
        return super().eventFilter(source, event)

    #############################################
    #   SLOTS
    ################################# 
Example 6
Project: eddy   Author: danielepantaleone   File: info.py    License: GNU General Public License v3.0 5 votes vote down vote up
def eventFilter(self, source, event):
        """
        Filter incoming events.
        :type source: QObject
        :type event: QtCore.QEvent
        """
        if source is self.verticalScrollBar():
            if event.type() in {QtCore.QEvent.Show, QtCore.QEvent.Hide}:
                self.redraw()
        return super().eventFilter(source, event)

    #############################################
    #   INTERFACE
    ################################# 
Example 7
Project: eddy   Author: danielepantaleone   File: overview.py    License: GNU General Public License v3.0 5 votes vote down vote up
def eventFilter(self, source, event):
        """
        Filters events if this object has been installed as an event filter for the watched object.
        :type source: QObject
        :type event: QtCore.QEvent
        :rtype: bool
        """
        if event.type() == QtCore.QEvent.Resize:
            widget = source.widget()
            widget.redraw()
        return super().eventFilter(source, event)

    #############################################
    #   SLOTS
    ################################# 
Example 8
Project: Hydra   Author: CountryTk   File: foldArea.py    License: GNU General Public License v3.0 5 votes vote down vote up
def leaveEvent(self, event: QEvent) -> None:

        self.returnCursorToNormal() 
Example 9
Project: Hydra   Author: CountryTk   File: Content.py    License: GNU General Public License v3.0 5 votes vote down vote up
def leaveEvent(self, event: QEvent) -> None:

        self.editor.returnCursorToNormal()
        super().leaveEvent(event) 
Example 10
Project: CvStudio   Author: haruiz   File: switch_button.py    License: MIT License 5 votes vote down vote up
def enterEvent(self, evt: QtCore.QEvent) -> None:
        shadow = QGraphicsDropShadowEffect(self)
        shadow.setBlurRadius(8)
        shadow.setColor(QtGui.QColor(76, 35, 45).lighter())
        shadow.setOffset(4)
        self.setGraphicsEffect(shadow)
        super(SwitchButton, self).enterEvent(evt) 
Example 11
Project: CvStudio   Author: haruiz   File: switch_button.py    License: MIT License 5 votes vote down vote up
def leaveEvent(self, evt: QtCore.QEvent) -> None:
        self.setGraphicsEffect(self._effect)
        super(SwitchButton, self).leaveEvent(evt) 
Example 12
Project: CvStudio   Author: haruiz   File: label_hovered.py    License: MIT License 5 votes vote down vote up
def enterEvent(self, evt: QtCore.QEvent) -> None:
        self._hover_thread = HoverThread()
        self._hover_thread.start()
        self._hover_thread.signals.timeoutSignal.connect(self.timeout_callback)
        super(LabelHovered, self).enterEvent(evt) 
Example 13
Project: CvStudio   Author: haruiz   File: label_hovered.py    License: MIT License 5 votes vote down vote up
def leaveEvent(self, evt: QtCore.QEvent) -> None:
        if self._hover_thread:
            self._hover_thread.join()
            del self._hover_thread
            super(LabelHovered, self).leaveEvent(evt) 
Example 14
Project: CvStudio   Author: haruiz   File: image_button.py    License: MIT License 5 votes vote down vote up
def enterEvent(self, evt: QtCore.QEvent) -> None:
        # self.setIconSize(QSize(math.floor(self._size.width() * 1.2),math.floor(self._size.height() * 1.2)))
        shadow = QGraphicsDropShadowEffect(self)
        shadow.setBlurRadius(8)
        # shadow.setColor(QtGui.QColor(76,35,45).lighter())
        shadow.setColor(QtGui.QColor(76, 35, 45).lighter())
        shadow.setOffset(4)
        self.setGraphicsEffect(shadow)
        super(ImageButton, self).enterEvent(evt) 
Example 15
Project: autokey   Author: autokey   File: autokey_treewidget.py    License: GNU General Public License v3.0 5 votes vote down vote up
def edit(self, index: QModelIndex, trigger: QAbstractItemView.EditTrigger, event: QEvent):
        if index.column() == 0:
            super(QTreeWidget, self).edit(index, trigger, event)
        return False 
Example 16
Project: urh   Author: jopohl   File: LiveGraphicView.py    License: GNU General Public License v3.0 5 votes vote down vote up
def leaveEvent(self, event: QEvent):
        super().leaveEvent(event)
        if isinstance(self.scene(), GridScene):
            self.scene().clear_frequency_marker()