示例#1
0
    def _createToolButton(self, widgetParams):
        """
        Returns a tool button created using the custom parameters. 
                
        @param widgetParams: A list containing tool button parameters. 
        @type  widgetParams: list
        
        @see: L{self._createWidgetUsingParameters} where this method is called.
        """

        buttonSize = QSize(32, 32)  #@ FOR TEST ONLY

        buttonParams = list(widgetParams)
        buttonId = buttonParams[1]
        buttonText = buttonParams[2]
        buttonIconPath = buttonParams[3]
        buttonToolTip = buttonParams[4]
        buttonShortcut = buttonParams[5]

        button = QToolButton(self)
        button.setText(buttonText)
        if buttonIconPath:
            buttonIcon = geticon(buttonIconPath)
            if not buttonIcon.isNull():
                button.setIcon(buttonIcon)
                button.setIconSize(QSize(22, 22))
        button.setToolTip(buttonToolTip)
        if buttonShortcut:
            button.setShortcut(buttonShortcut)

        button.setFixedSize(buttonSize)  #@ Currently fixed to 32 x 32.
        button.setCheckable(True)
        return button
示例#2
0
 def _createToolButton(self, widgetParams):
     """
     Returns a tool button created using the custom parameters. 
             
     @param widgetParams: A list containing tool button parameters. 
     @type  widgetParams: list
     
     @see: L{self._createWidgetUsingParameters} where this method is called.
     """
     
     buttonSize = QSize(32, 32) #@ FOR TEST ONLY
     
     buttonParams = list(widgetParams)
     buttonId       = buttonParams[1]
     buttonText     = buttonParams[2]
     buttonIconPath = buttonParams[3]
     buttonToolTip  = buttonParams[4] 
     buttonShortcut = buttonParams[5]
     
     button = QToolButton(self)
     button.setText(buttonText)
     if buttonIconPath:
         buttonIcon = geticon(buttonIconPath)     
         if not buttonIcon.isNull():       
             button.setIcon(buttonIcon)
             button.setIconSize(QSize(22, 22))
     button.setToolTip(buttonToolTip)
     if buttonShortcut:
         button.setShortcut(buttonShortcut)
         
     button.setFixedSize(buttonSize) #@ Currently fixed to 32 x 32.
     button.setCheckable(True)
     return button