# eric7.EricWidgets.EricTabWidget

Module implementing a TabWidget class substituting QTabWidget.

### Global Attributes

None

### Classes

EricDnDTabBar | Class implementing a tab bar class substituting QTabBar.
EricTabWidget | Class implementing a tab widget class substituting QTabWidget.
EricWheelTabBar | Class implementing a tab bar class substituting QTabBar to support wheel events.

### Functions

None

## EricDnDTabBar

Class implementing a tab bar class substituting QTabBar.

### Signals

tabMoveRequested(int, int)
  emitted to signal a tab move request giving the old and new index position

### Derived from

EricWheelTabBar

### Class Attributes

None

### Class Methods

None

### Methods

EricDnDTabBar | Constructor
dragEnterEvent | Protected method to handle drag enter events.
dropEvent | Protected method to handle drop events.
mouseMoveEvent | Protected method to handle mouse move events.
mousePressEvent | Protected method to handle mouse press events.

### Static Methods

None

#### EricDnDTabBar (Constructor)

EricDnDTabBar(parent=None)

Constructor

parent
  reference to the parent widget (QWidget)

#### EricDnDTabBar.dragEnterEvent

dragEnterEvent(event)

Protected method to handle drag enter events.

event
  reference to the drag enter event (QDragEnterEvent)

#### EricDnDTabBar.dropEvent

dropEvent(event)

Protected method to handle drop events.

event
  reference to the drop event (QDropEvent)

#### EricDnDTabBar.mouseMoveEvent

mouseMoveEvent(event)

Protected method to handle mouse move events.

event
  reference to the mouse move event (QMouseEvent)

#### EricDnDTabBar.mousePressEvent

mousePressEvent(event)

Protected method to handle mouse press events.

event
  reference to the mouse press event (QMouseEvent)

Up

## EricTabWidget

Class implementing a tab widget class substituting QTabWidget.

It provides slots to show the previous and next tab and give them the input focus and it allows to have a context menu for the tabs.

### Signals

customTabContextMenuRequested(const QPoint & point, int index)
  emitted when a context menu for a tab is requested

### Derived from

QTabWidget

### Class Attributes

None

### Class Methods

None

### Methods

EricTabWidget | Constructor
__currentChanged | Private slot to handle the currentChanged signal.
__freeSide | Private method to determine the free side of a tab.
__handleTabCustomContextMenuRequested | Private slot to handle the context menu request for the tabbar.
animationLabel | Public slot to set an animated icon.
moveTab | Public method to move a tab to a new index.
nextTab | Public slot used to show the next tab.
prevTab | Public slot used to show the previous tab.
resetAnimation | Public slot to reset an animated icon.
selectTab | Public method to get the index of a tab given a position.
setCustomTabBar | Public method to set a custom tab bar.
setTabContextMenuPolicy | Public method to set the context menu policy of the tab.
switchTab | Public slot used to switch between the current and the previous current tab.

### Static Methods

None

#### EricTabWidget (Constructor)

EricTabWidget(parent=None, dnd=False)

Constructor

parent
  reference to the parent widget (QWidget)
dnd
  flag indicating the support for Drag & Drop (boolean)

#### EricTabWidget.__currentChanged

__currentChanged(index)

Private slot to handle the currentChanged signal.

index
  index of the current tab

#### EricTabWidget.__freeSide

__freeSide()

Private method to determine the free side of a tab.

Return:
  free side (QTabBar.ButtonPosition)

#### EricTabWidget.__handleTabCustomContextMenuRequested

__handleTabCustomContextMenuRequested(point)

Private slot to handle the context menu request for the tabbar.

point
  point the context menu was requested (QPoint)

#### EricTabWidget.animationLabel

animationLabel(index, animationFile, interval=100)

Public slot to set an animated icon.

index (int)
  tab index
animationFile (str)
  name of the file containing the animation
interval (int)
  interval in milliseconds between animation frames

Return:
  reference to the created label

Return Type:
  EricAnimatedLabel

#### EricTabWidget.moveTab

moveTab(curIndex, newIndex)

Public method to move a tab to a new index.

curIndex
  index of tab to be moved (integer)
newIndex
  index the tab should be moved to (integer)

#### EricTabWidget.nextTab

nextTab()

Public slot used to show the next tab.

#### EricTabWidget.prevTab

prevTab()

Public slot used to show the previous tab.

#### EricTabWidget.resetAnimation

resetAnimation(index)

Public slot to reset an animated icon.

index
  tab index (integer)

#### EricTabWidget.selectTab

selectTab(pos)

Public method to get the index of a tab given a position.

pos
  position determining the tab index (QPoint)

Return:
  index of the tab (integer)

#### EricTabWidget.setCustomTabBar

setCustomTabBar(dnd, tabBar)

Public method to set a custom tab bar.

dnd
  flag indicating the support for Drag & Drop (boolean)
tabBar
  reference to the tab bar to set (QTabBar)

#### EricTabWidget.setTabContextMenuPolicy

setTabContextMenuPolicy(policy)

Public method to set the context menu policy of the tab.

policy
  context menu policy to set (Qt.ContextMenuPolicy)

#### EricTabWidget.switchTab

switchTab()

Public slot used to switch between the current and the previous current tab.

Up

## EricWheelTabBar

Class implementing a tab bar class substituting QTabBar to support wheel events.

### Derived from

QTabBar

### Class Attributes

None

### Class Methods

None

### Methods

EricWheelTabBar | Constructor
wheelEvent | Protected slot to support wheel events.

### Static Methods

None

#### EricWheelTabBar (Constructor)

EricWheelTabBar(parent=None)

Constructor

parent
  reference to the parent widget (QWidget)

#### EricWheelTabBar.wheelEvent

wheelEvent(event)

Protected slot to support wheel events.

event
  reference to the wheel event (QWheelEvent)

Up