Esempio n. 1
0
 def mouseMoveEvent(self, evt):
     """
     Protected method to handle mouse move events.
     
     @param evt reference to the mouse move event (QMouseEvent)
     """
     if self.count() == 1:
         return
     
     E5WheelTabBar.mouseMoveEvent(self, evt)
     
     if Preferences.getHelp("ShowPreview"):
         # Find the tab under the mouse
         i = 0
         tabIndex = -1
         while i < self.count() and tabIndex == -1:
             if self.tabRect(i).contains(evt.pos()):
                 tabIndex = i
             i += 1
         
         # If found and not the current tab then show tab preview
         if tabIndex != -1 and \
            tabIndex != self.currentIndex() and \
            self.__currentTabPreviewIndex != tabIndex and \
            evt.buttons() == Qt.NoButton:
             self.__currentTabPreviewIndex = tabIndex
             QTimer.singleShot(200, self.__showTabPreview)
         
         # If current tab or not found then hide previous tab preview
         if tabIndex == self.currentIndex() or \
            tabIndex == -1:
             if self.__previewPopup is not None:
                 self.__previewPopup.hide()
             self.__currentTabPreviewIndex = -1
Esempio n. 2
0
    def mouseMoveEvent(self, evt):
        """
        Protected method to handle mouse move events.
        
        @param evt reference to the mouse move event (QMouseEvent)
        """
        if self.count() == 1:
            return

        E5WheelTabBar.mouseMoveEvent(self, evt)

        if Preferences.getHelp("ShowPreview"):
            # Find the tab under the mouse
            i = 0
            tabIndex = -1
            while i < self.count() and tabIndex == -1:
                if self.tabRect(i).contains(evt.pos()):
                    tabIndex = i
                i += 1

            # If found and not the current tab then show tab preview
            if tabIndex != -1 and \
               tabIndex != self.currentIndex() and \
               self.__currentTabPreviewIndex != tabIndex and \
               evt.buttons() == Qt.NoButton:
                self.__currentTabPreviewIndex = tabIndex
                QTimer.singleShot(200, self.__showTabPreview)

            # If current tab or not found then hide previous tab preview
            if tabIndex == self.currentIndex() or \
               tabIndex == -1:
                if self.__previewPopup is not None:
                    self.__previewPopup.hide()
                self.__currentTabPreviewIndex = -1
Esempio n. 3
0
 def mousePressEvent(self, evt):
     """
     Protected method to handle mouse press events.
     
     @param evt reference to the mouse press event (QMouseEvent)
     """
     if Preferences.getHelp("ShowPreview"):
         if self.__previewPopup is not None:
             self.__previewPopup.hide()
         self.__currentTabPreviewIndex = -1
     
     E5WheelTabBar.mousePressEvent(self, evt)
Esempio n. 4
0
    def mousePressEvent(self, evt):
        """
        Protected method to handle mouse press events.
        
        @param evt reference to the mouse press event (QMouseEvent)
        """
        if Preferences.getHelp("ShowPreview"):
            if self.__previewPopup is not None:
                self.__previewPopup.hide()
            self.__currentTabPreviewIndex = -1

        E5WheelTabBar.mousePressEvent(self, evt)
Esempio n. 5
0
 def leaveEvent(self, evt):
     """
     Protected method to handle leave events.
     
     @param evt reference to the leave event (QEvent)
     """
     if Preferences.getHelp("ShowPreview"):
         # If leave tabwidget then hide previous tab preview
         if self.__previewPopup is not None:
             self.__previewPopup.hide()
         self.__currentTabPreviewIndex = -1
     
     E5WheelTabBar.leaveEvent(self, evt)
Esempio n. 6
0
    def leaveEvent(self, evt):
        """
        Protected method to handle leave events.
        
        @param evt reference to the leave event (QEvent)
        """
        if Preferences.getHelp("ShowPreview"):
            # If leave tabwidget then hide previous tab preview
            if self.__previewPopup is not None:
                self.__previewPopup.hide()
            self.__currentTabPreviewIndex = -1

        E5WheelTabBar.leaveEvent(self, evt)
Esempio n. 7
0
 def __init__(self, parent=None):
     """
     Constructor
     
     @param parent reference to the parent widget (HelpTabWidget)
     """
     E5WheelTabBar.__init__(self, parent)
     
     self.__tabWidget = parent
     
     self.__previewPopup = None
     self.__currentTabPreviewIndex = -1
     
     self.setMouseTracking(True)
Esempio n. 8
0
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget (HelpTabWidget)
        """
        E5WheelTabBar.__init__(self, parent)

        self.__tabWidget = parent

        self.__previewPopup = None
        self.__currentTabPreviewIndex = -1

        self.setMouseTracking(True)
Esempio n. 9
0
 def event(self, evt):
     """
     Public method to handle event.
     
     This event handler just handles the tooltip event and passes the
     handling of all others to the superclass.
     
     @param evt reference to the event to be handled (QEvent)
     @return flag indicating, if the event was handled (boolean)
     """
     if evt.type() == QEvent.ToolTip and \
        Preferences.getHelp("ShowPreview"):
         # suppress tool tips if we are showing previews
         evt.setAccepted(True)
         return True
     
     return E5WheelTabBar.event(self, evt)
Esempio n. 10
0
    def event(self, evt):
        """
        Public method to handle event.
        
        This event handler just handles the tooltip event and passes the
        handling of all others to the superclass.
        
        @param evt reference to the event to be handled (QEvent)
        @return flag indicating, if the event was handled (boolean)
        """
        if evt.type() == QEvent.ToolTip and \
           Preferences.getHelp("ShowPreview"):
            # suppress tool tips if we are showing previews
            evt.setAccepted(True)
            return True

        return E5WheelTabBar.event(self, evt)