# eric7.EricWidgets.EricIconBar

Module implementing a bar widget showing just icons.

### Global Attributes

None

### Classes

EricIconBar | Class implementing a bar widget showing just icons.

### Functions

None

## EricIconBar

Class implementing a bar widget showing just icons.

### Signals

currentChanged(index)
  emitted to indicate a change of the current index
currentClicked(index)
  emitted to indicate, that the current icon was clicked

### Derived from

QWidget

### Class Attributes

BarSizes
DefaultBarSize
LabelStyleSheetTemplate
MenuStyleSheetTemplate
MoreLabelAspect
WidgetStyleSheetTemplate

### Class Methods

None

### Methods

EricIconBar | Constructor
__adjustIconLabels | Private method to adjust the visibility of the icon labels.
__createAndAddMoreLabel | Private method to create the label to be shown for too many icons.
__createIcon | Private method to creat an icon label.
__iconClicked | Private slot to handle an icon been clicked.
__moreLabelClicked | Private slot to handle a click onto the 'More' label.
addIcon | Public method to add an icon to the bar.
barSize | Public method to get the icon bar size.
color | Public method to return the current color.
count | Public method to get the number of icon labels.
currentIndex | Public method to get the current index.
insertIcon | Public method to insert an icon into the bar.
nextIcon | Public slot to set the icon after the current one.
orientation | Public method to get the orientation of the widget.
previousIcon | Public slot to set the icon before the current one.
removeIcon | Public method to remove an icon from the bar.
resizeEvent | Protected method to handle resizing of the icon bar.
setBarSize | Public method to set the icon bar size.
setColor | Public method to set the color of the widget.
setCurrentIndex | Public method to set the current index.
setOrientation | Public method to set the widget orientation.
wheelEvent | Protected method to handle a wheel event.

### Static Methods

None

#### EricIconBar (Constructor)

EricIconBar(orientation=Qt.Orientation.Horizontal, barSize=DefaultBarSize, parent=None)

Constructor

orientation (Qt.Orientation)
  orientation for the widget
barSize (str)
  size category for the bar (one of 'xs', 'sm', 'md', 'lg', 'xl', 'xxl')
parent (QWidget (optional))
  reference to the parent widget (defaults to None)

#### EricIconBar.__adjustIconLabels

__adjustIconLabels()

Private method to adjust the visibility of the icon labels.

#### EricIconBar.__createAndAddMoreLabel

__createAndAddMoreLabel()

Private method to create the label to be shown for too many icons.

#### EricIconBar.__createIcon

__createIcon(icon, label="")

Private method to creat an icon label.

icon (QIcon)
  reference to the icon
label (str (optional))
  label text to be shown as a tooltip (defaults to "")

Return:
  created and connected label

Return Type:
  EricClickableLabel

#### EricIconBar.__iconClicked

__iconClicked(label)

Private slot to handle an icon been clicked.

label (EricClickableLabel)
  reference to the clicked label

#### EricIconBar.__moreLabelClicked

__moreLabelClicked()

Private slot to handle a click onto the 'More' label.

#### EricIconBar.addIcon

addIcon(icon, label="")

Public method to add an icon to the bar.

icon (QIcon)
  reference to the icon
label (str (optional))
  label text to be shown as a tooltip (defaults to "")

#### EricIconBar.barSize

barSize()

Public method to get the icon bar size.

Return:
  barSize size category for the bar (one of 'xs', 'sm', 'md', 'lg', 'xl', 'xxl')

Return Type:
  str

#### EricIconBar.color

color()

Public method to return the current color.

Return:
  current color

Return Type:
  QColor

#### EricIconBar.count

count()

Public method to get the number of icon labels.

Return:
  number of icon labels

Return Type:
  int

#### EricIconBar.currentIndex

currentIndex()

Public method to get the current index.

Return:
  current index

Return Type:
  int

#### EricIconBar.insertIcon

insertIcon(index, icon, label="")

Public method to insert an icon into the bar.

index (int)
  position to insert the icon at
icon (QIcon)
  reference to the icon
label (str (optional))
  label text to be shown as a tooltip (defaults to "")

#### EricIconBar.nextIcon

nextIcon()

Public slot to set the icon after the current one.

#### EricIconBar.orientation

orientation()

Public method to get the orientation of the widget.

Return:
  orientation of the widget

Return Type:
  Qt.Orientation

#### EricIconBar.previousIcon

previousIcon()

Public slot to set the icon before the current one.

#### EricIconBar.removeIcon

removeIcon(index)

Public method to remove an icon from the bar.

index (int)
  index of the icon to be removed

#### EricIconBar.resizeEvent

resizeEvent(evt)

Protected method to handle resizing of the icon bar.

evt (QResizeEvent)
  reference to the event object

#### EricIconBar.setBarSize

setBarSize(barSize)

Public method to set the icon bar size.

barSize (str)
  size category for the bar (one of 'xs', 'sm', 'md', 'lg', 'xl', 'xxl')

#### EricIconBar.setColor

setColor(color)

Public method to set the color of the widget.

color (QColor)
  color of the widget

#### EricIconBar.setCurrentIndex

setCurrentIndex(index)

Public method to set the current index.

index (int)
  current index to be set

#### EricIconBar.setOrientation

setOrientation(orientation)

Public method to set the widget orientation.

orientation (Qt.Orientation)
  orientation to be set

#### EricIconBar.wheelEvent

wheelEvent(evt)

Protected method to handle a wheel event.

evt (QWheelEvent)
  reference to the wheel event

Up