# eric6.E5Gui.E5ToolButton

Module implementing a specialized tool button subclass.

### Global Attributes

None

### Classes

E5ToolButton | Class implementing a specialized tool button subclass.

### Functions

None

## E5ToolButton

Class implementing a specialized tool button subclass.

### Signals

aboutToHideMenu()
  emitted before the tool button menu is hidden
aboutToShowMenu()
  emitted before the tool button menu is shown
controlClicked()
  emitted when the left mouse button was clicked while pressing the Ctrl key
doubleClicked()
  emitted when the left mouse button was double clicked
middleClicked()
  emitted when the middle mouse button was clicked

### Derived from

QToolButton

### Class Attributes

NoOptions
ShowMenuInsideOption
ToolBarLookOption

### Class Methods

None

### Methods

E5ToolButton | Constructor
__menuAboutToHide | Private slot to handle the tool button menu about to be hidden.
__showMenu | Private slot to show the tool button menu.
badgeText | Public method to get the badge text.
contextMenuEvent | Protected method to handle context menu events.
menu | Public method to get a reference to the tool button menu.
mouseDoubleClickEvent | Protected method to handle mouse double click events.
mousePressEvent | Protected method to handle mouse press events.
mouseReleaseEvent | Protected method to handle mouse release events.
setBadgeText | Public method to set the badge text.
setMenu | Public method to set the tool button menu.
setShowMenuInside | Public method to set a flag to show the menu edge aligned with the button.
setToolbarButtonLook | Public method to set the toolbar look state.
showMenuInside | Public method to check, if the menu edge shall be aligned with the button.
toolbarButtonLook | Public method to check, if the button has the toolbar look.

### Static Methods

None

#### E5ToolButton (Constructor)

E5ToolButton(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### E5ToolButton.__menuAboutToHide

__menuAboutToHide()

Private slot to handle the tool button menu about to be hidden.

#### E5ToolButton.__showMenu

__showMenu()

Private slot to show the tool button menu.

#### E5ToolButton.badgeText

badgeText()

Public method to get the badge text.

Returns:
  badge text

Return Type:
  str

#### E5ToolButton.contextMenuEvent

contextMenuEvent(evt)

Protected method to handle context menu events.

evt (QContextMenuEvent)
  reference to the context menu event

#### E5ToolButton.menu

menu()

Public method to get a reference to the tool button menu.

Returns:
  reference to the tool button menu

Return Type:
  QMenu

#### E5ToolButton.mouseDoubleClickEvent

mouseDoubleClickEvent(evt)

Protected method to handle mouse double click events.

evt (QMouseEvent)
  reference to the mouse event

#### E5ToolButton.mousePressEvent

mousePressEvent(evt)

Protected method to handle mouse press events.

evt (QMouseEvent)
  reference to the mouse event

#### E5ToolButton.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method to handle mouse release events.

evt (QMouseEvent)
  reference to the mouse event

#### E5ToolButton.setBadgeText

setBadgeText(text)

Public method to set the badge text.

text (str)
  badge text to be set

#### E5ToolButton.setMenu

setMenu(menu)

Public method to set the tool button menu.

menu (QMenu)
  reference to the tool button menu

#### E5ToolButton.setShowMenuInside

setShowMenuInside(enable)

Public method to set a flag to show the menu edge aligned with the button.

enable (bool)
  flag indicating to align the menu edge to the button

#### E5ToolButton.setToolbarButtonLook

setToolbarButtonLook(enable)

Public method to set the toolbar look state.

enable (bool)
  flag indicating toolbar look

#### E5ToolButton.showMenuInside

showMenuInside()

Public method to check, if the menu edge shall be aligned with the button.

Returns:
  flag indicating that the menu edge shall be aligned

Return Type:
  bool

#### E5ToolButton.toolbarButtonLook

toolbarButtonLook()

Public method to check, if the button has the toolbar look.

Returns:
  flag indicating toolbar look

Return Type:
  bool

Up