Python PyQt5.QtCore.QEvent() Examples

The following are 16 code examples of PyQt5.QtCore.QEvent(). 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 also want to check out all available functions/classes of the module PyQt5.QtCore , or try the search function .
Example #1
Source File: mainwindow.py    From track with Apache License 2.0 11 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
Source File: palette.py    From eddy with GNU General Public License v3.0 7 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 #3
Source File: palette.py    From eddy with GNU General Public License v3.0 7 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 #4
Source File: foldArea.py    From Hydra with GNU General Public License v3.0 7 votes vote down vote up
def leaveEvent(self, event: QEvent) -> None:

        self.returnCursorToNormal() 
Example #5
Source File: Content.py    From Hydra with GNU General Public License v3.0 7 votes vote down vote up
def leaveEvent(self, event: QEvent) -> None:

        self.editor.returnCursorToNormal()
        super().leaveEvent(event) 
Example #6
Source File: switch_button.py    From CvStudio with MIT License 7 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 #7
Source File: label_hovered.py    From CvStudio with MIT License 7 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 #8
Source File: image_button.py    From CvStudio with MIT License 7 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 #9
Source File: autokey_treewidget.py    From autokey with GNU General Public License v3.0 7 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 #10
Source File: switch_button.py    From CvStudio with MIT License 6 votes vote down vote up
def leaveEvent(self, evt: QtCore.QEvent) -> None:
        self.setGraphicsEffect(self._effect)
        super(SwitchButton, self).leaveEvent(evt) 
Example #11
Source File: label_hovered.py    From CvStudio with MIT License 6 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 #12
Source File: info.py    From eddy with GNU General Public License v3.0 4 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 #13
Source File: info.py    From eddy with GNU General Public License v3.0 4 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 #14
Source File: debug.py    From qutebrowser with GNU General Public License v3.0 3 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 #15
Source File: overview.py    From eddy with GNU General Public License v3.0 3 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 #16
Source File: LiveGraphicView.py    From urh with GNU General Public License v3.0 3 votes vote down vote up
def leaveEvent(self, event: QEvent):
        super().leaveEvent(event)
        if isinstance(self.scene(), GridScene):
            self.scene().clear_frequency_marker()