Beispiel #1
0
 def eventFilter(self, obj, event):
     etype = event.type()
     if etype == QEvent.Move or etype == QEvent.Resize:
         self.__updateGeometry()
     elif etype == QEvent.Show:
         self.__updateGeometry()
         self.show()
     elif etype == QEvent.Hide:
         self.hide()
     return QWidget.eventFilter(self, obj, event)
Beispiel #2
0
 def eventFilter(self, obj, event):
     etype = event.type()
     if etype == QEvent.Move or etype == QEvent.Resize:
         self.__updateGeometry()
     elif etype == QEvent.Show:
         self.__updateGeometry()
         self.show()
     elif etype == QEvent.Hide:
         self.hide()
     return QWidget.eventFilter(self, obj, event)
    def eventFilter(self, receiver, event):
        if event.type() == QEvent.MouseMove and \
                isinstance(receiver, TabButton):
            pos = receiver.mapTo(self, event.pos())
            if self.__sloppyRegion.contains(pos):
                self.__setSloppyButton(receiver)
            else:
                if not receiver.isChecked():
                    index = [tab.button for tab in self.__tabs].index(receiver)
                    self.setCurrentIndex(index)
                #also update sloppy region if mouse is moved on the same icon
                self.__sloppyRegion = self.__calcSloppyRegion(pos)

        return QWidget.eventFilter(self, receiver, event)
Beispiel #4
0
    def eventFilter(self, receiver, event):
        if event.type() == QEvent.MouseMove and \
                isinstance(receiver, TabButton):
            pos = receiver.mapTo(self, event.pos())
            if self.__sloppyRegion.contains(pos):
                self.__setSloppyButton(receiver)
            else:
                if not receiver.isChecked():
                    index = [tab.button for tab in self.__tabs].index(receiver)
                    self.setCurrentIndex(index)
                #also update sloppy region if mouse is moved on the same icon
                self.__sloppyRegion = self.__calcSloppyRegion(pos)

        return QWidget.eventFilter(self, receiver, event)
    def eventFilter(self, obj, event):
        if obj is self.__view and event.type() == QEvent.KeyPress:
            key = event.key()

            space_activates = self.style().styleHint(
                QStyle.SH_Menu_SpaceActivatesItem, None, None)

            if key in [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Select
                       ] or (key == Qt.Key_Space and space_activates):
                index = self.__view.currentIndex()
                if index.isValid() and index.flags() & Qt.ItemIsEnabled:
                    # Emit activated on behalf of QTreeView.
                    self.__view.activated.emit(index)
                return True

        return QWidget.eventFilter(self, obj, event)
Beispiel #6
0
    def eventFilter(self, obj, event):
        if obj is self.__view and event.type() == QEvent.KeyPress:
            key = event.key()

            space_activates = \
                self.style().styleHint(
                        QStyle.SH_Menu_SpaceActivatesItem,
                        None, None)

            if key in [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Select] or \
                    (key == Qt.Key_Space and space_activates):
                index = self.__view.currentIndex()
                if index.isValid() and index.flags() & Qt.ItemIsEnabled:
                    # Emit activated on behalf of QTreeView.
                    self.__view.activated.emit(index)
                return True

        return QWidget.eventFilter(self, obj, event)