# eric7.EricWidgets.EricToolButton

Module implementing a specialized tool button subclass.

### Global Attributes

None

### Classes

EricToolButton | Class implementing a specialized tool button subclass.
EricToolButtonOptions | Class defining the tool button options.

### Functions

None

## EricToolButton

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

None

### Class Methods

None

### Methods

EricToolButton | 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.
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

#### EricToolButton (Constructor)

EricToolButton(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### EricToolButton.__menuAboutToHide

__menuAboutToHide()

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

#### EricToolButton.__showMenu

__showMenu()

Private slot to show the tool button menu.

#### EricToolButton.badgeText

badgeText()

Public method to get the badge text.

Return:
  badge text

Return Type:
  str

#### EricToolButton.menu

menu()

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

Return:
  reference to the tool button menu

Return Type:
  QMenu

#### EricToolButton.mouseDoubleClickEvent

mouseDoubleClickEvent(evt)

Protected method to handle mouse double click events.

evt (QMouseEvent)
  reference to the mouse event

#### EricToolButton.mousePressEvent

mousePressEvent(evt)

Protected method to handle mouse press events.

evt (QMouseEvent)
  reference to the mouse event

#### EricToolButton.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method to handle mouse release events.

evt (QMouseEvent)
  reference to the mouse event

#### EricToolButton.setBadgeText

setBadgeText(text)

Public method to set the badge text.

text (str)
  badge text to be set

#### EricToolButton.setMenu

setMenu(menu)

Public method to set the tool button menu.

menu (QMenu)
  reference to the tool button menu

#### EricToolButton.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

#### EricToolButton.setToolbarButtonLook

setToolbarButtonLook(enable)

Public method to set the toolbar look state.

enable (bool)
  flag indicating toolbar look

#### EricToolButton.showMenuInside

showMenuInside()

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

Return:
  flag indicating that the menu edge shall be aligned

Return Type:
  bool

#### EricToolButton.toolbarButtonLook

toolbarButtonLook()

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

Return:
  flag indicating toolbar look

Return Type:
  bool

Up

## EricToolButtonOptions

Class defining the tool button options.

### Derived from

enum.IntEnum

### Class Attributes

DEFAULT
SHOW_MENU_INSIDE
TOOLBAR_LOOKUP

### Class Methods

None

### Methods

None

### Static Methods

None

Up