# eric7.EricWidgets.EricSideBar

Module implementing a sidebar class.

### Global Attributes

None

### Classes

EricSideBar | Class implementing a sidebar with a widget area, that is hidden or shown, if the current tab is clicked again.
EricSideBarSide | Class defining the sidebar sides.

### Functions

None

## EricSideBar

Class implementing a sidebar with a widget area, that is hidden or shown, if the current tab is clicked again.

### Derived from

QWidget

### Class Attributes

Version

### Class Methods

None

### Methods

EricSideBar | Constructor
__currentIconChanged | Private slot to handle a change of the current icon.
__currentIconClicked | Private slot to handle a click of the current icon.
__expandIt | Private method to expand the sidebar.
__shrinkIt | Private method to shrink the sidebar.
addTab | Public method to add a tab to the sidebar.
barSize | Public method to get the icon bar size.
clear | Public method to remove all tabs.
count | Public method to get the number of tabs.
currentIndex | Public method to get the index of the current tab.
currentWidget | Public method to get a reference to the current widget.
iconBarColor | Public method to get the icon bar color.
indexOf | Public method to get the index of the given widget.
insertTab | Public method to insert a tab into the sidebar.
isMinimized | Public method to check the minimized state.
nextTab | Public slot used to show the next tab.
orientation | Public method to get the orientation of the sidebar.
prevTab | Public slot used to show the previous tab.
removeTab | Public method to remove a tab.
restoreState | Public method to restore the state of the sidebar.
saveState | Public method to save the state of the sidebar.
setCurrentIndex | Public slot to set the current index.
setCurrentWidget | Public slot to set the current widget.
setIconBarColor | Public method to set the icon bar color.
setIconBarSize | Public method to set the icon bar size.
setOrientation | Public method to set the orientation of the sidebar.
widget | Public method to get a reference to the widget associated with a tab.

### Static Methods

None

#### EricSideBar (Constructor)

EricSideBar(orientation=None, iconBarSize=EricIconBar.DefaultBarSize, parent=None)

Constructor

orientation (EricSideBarSide)
  orientation of the sidebar widget
iconBarSize (str)
  size category for the bar (one of 'xs', 'sm', 'md', 'lg', 'xl', 'xxl')
parent (QWidget)
  parent widget

#### EricSideBar.__currentIconChanged

__currentIconChanged(index)

Private slot to handle a change of the current icon.

index (int)
  index of the current icon

#### EricSideBar.__currentIconClicked

__currentIconClicked(index)

Private slot to handle a click of the current icon.

index (int)
  index of the clicked icon

#### EricSideBar.__expandIt

__expandIt()

Private method to expand the sidebar.

#### EricSideBar.__shrinkIt

__shrinkIt()

Private method to shrink the sidebar.

#### EricSideBar.addTab

addTab(widget, icon, label=None)

Public method to add a tab to the sidebar.

widget (QWidget)
  reference to the widget to add
icon (QIcon)
  reference to the icon of the widget
label (str)
  the label text of the widget

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

#### EricSideBar.clear

clear()

Public method to remove all tabs.

#### EricSideBar.count

count()

Public method to get the number of tabs.

Return:
  number of tabs in the sidebar (integer)

#### EricSideBar.currentIndex

currentIndex()

Public method to get the index of the current tab.

Return:
  index of the current tab (integer)

#### EricSideBar.currentWidget

currentWidget()

Public method to get a reference to the current widget.

Return:
  reference to the current widget (QWidget)

#### EricSideBar.iconBarColor

iconBarColor()

Public method to get the icon bar color.

Return:
  icon bar color

Return Type:
  QColor

#### EricSideBar.indexOf

indexOf(widget)

Public method to get the index of the given widget.

widget
  reference to the widget to get the index of (QWidget)

Return:
  index of the given widget (integer)

#### EricSideBar.insertTab

insertTab(index, widget, icon, label=None)

Public method to insert a tab into the sidebar.

index (int)
  the index to insert the tab at
widget (QWidget)
  reference to the widget to insert
icon (QIcon)
  reference to the icon of the widget
label (str)
  the label text of the widget

#### EricSideBar.isMinimized

isMinimized()

Public method to check the minimized state.

Return:
  flag indicating the minimized state (boolean)

#### EricSideBar.nextTab

nextTab()

Public slot used to show the next tab.

#### EricSideBar.orientation

orientation()

Public method to get the orientation of the sidebar.

Return:
  orientation of the sidebar

Return Type:
  EricSideBarSide

#### EricSideBar.prevTab

prevTab()

Public slot used to show the previous tab.

#### EricSideBar.removeTab

removeTab(index)

Public method to remove a tab.

index (int)
  the index of the tab to remove

#### EricSideBar.restoreState

restoreState(state)

Public method to restore the state of the sidebar.

state
  byte array containing the saved state (QByteArray)

Return:
  flag indicating success (boolean)

#### EricSideBar.saveState

saveState()

Public method to save the state of the sidebar.

Return:
  saved state as a byte array (QByteArray)

#### EricSideBar.setCurrentIndex

setCurrentIndex(index)

Public slot to set the current index.

index
  the index to set as the current index (integer)

#### EricSideBar.setCurrentWidget

setCurrentWidget(widget)

Public slot to set the current widget.

widget
  reference to the widget to become the current widget (QWidget)

#### EricSideBar.setIconBarColor

setIconBarColor(color)

Public method to set the icon bar color.

color (QColor)
  icon bar color

#### EricSideBar.setIconBarSize

setIconBarSize(barSize)

Public method to set the icon bar size.

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

#### EricSideBar.setOrientation

setOrientation(orient)

Public method to set the orientation of the sidebar.

orient (EricSideBarSide)
  orientation of the sidebar

#### EricSideBar.widget

widget(index)

Public method to get a reference to the widget associated with a tab.

index
  index of the tab (integer)

Return:
  reference to the widget (QWidget)

Up

## EricSideBarSide

Class defining the sidebar sides.

### Derived from

enum.Enum

### Class Attributes

EAST
NORTH
SOUTH
WEST

### Class Methods

None

### Methods

None

### Static Methods

None

Up