# class KTabWidget

###

Module | kdeui
Namespace |
Class | KTabWidget
Inherits | QTabWidget

A widget containing multiple tabs

It extends the Qt QTabWidget, providing extra optionally features such as close buttons when you hover over the icon in the tab, and also adds functionality such as responding to mouse wheel scroll events to switch the active tab.

It is recommended to use KTabWidget instead of QTabWidget unless you have a good reason not to.

See also the QTabWidget documentation.

### methods

- KTabWidget (parent, flags)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | QWidget | 0
  flags | Qt.WFlags | 0

  Creates a new tab widget.

  parent - The parent widgets.

  flags - The Qt window flags

  See also QWidget.

- KTabWidget (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget | 0
  a1 | Qt.WFlags | 0

- automaticResizeTabs ( )

  returns bool

  Returns true if calling setTitle() will resize tabs to the width of the tab bar.

- closeRequest (a0)

  returns Nothing
  SIGNAL ("closeRequest (QWidget*)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |

  The close button of a widget's tab was clicked. This signal is only possible after you have called setCloseButtonEnabled( true ).

- closeRequest (a0)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

- contextMenu (a0)

  returns Nothing
  Not implemented SIGNAL ("contextMenu (const QPoint&)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QPoint |

  The right mouse button was pressed over empty space besides tabbar.

- contextMenu (a0, a1)

  returns Nothing
  SIGNAL ("contextMenu (QWidget*, const QPoint&)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |
  a1 | QPoint |

  The right mouse button was pressed over a widget.

- contextMenu (a0, a1)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | int |
  a1 | QPoint |

- dragEnterEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QDragEnterEvent |

- dragMoveEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QDragMoveEvent |

- dropEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QDropEvent |

- hoverCloseButton ( )

  returns bool

  Returns true if the close button is shown on tabs when mouse is hovering over them.

  Deprecated Use KTabWidget.isCloseButtonEnabled() instead.

- hoverCloseButtonDelayed ( )

  returns bool

  Returns true if the close button is shown on tabs after a delay.

  Deprecated Use KTabWidget.isCloseButtonEnabled() instead.

- initiateDrag (a0)

  returns Nothing
  SIGNAL ("initiateDrag (QWidget*)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |

  Request to start a drag operation on the given tab.

- initiateDrag (a0)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

- isCloseButtonEnabled ( )

  returns bool
  KDE 4.1.0 and later only

  Returns true if the close button is shown on tabs.

  @since 4.1

- isTabBarHidden ( )

  returns bool

  Returns true if the tabbar is hidden.

- isTabReorderingEnabled ( )

  returns bool

  Returns true if tab ordering with the middle mouse button has been enabled.

- mouseDoubleClick ( )

  returns Nothing
  SIGNAL ("mouseDoubleClick ()")

  A double left mouse button click was performed over empty space besides tabbar.

- mouseDoubleClick (a0)

  returns Nothing
  SIGNAL ("mouseDoubleClick (QWidget*)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |

  A double left mouse button click was performed over the widget.

- mouseDoubleClick (a0)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

- mouseDoubleClickEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QMouseEvent |

- mouseMiddleClick ( )

  returns Nothing
  SIGNAL ("mouseMiddleClick ()")

  A middle mouse button click was performed over empty space besides tabbar.

- mouseMiddleClick (a0)

  returns Nothing
  SIGNAL ("mouseMiddleClick (QWidget*)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |

  A middle mouse button click was performed over the widget.

- mouseMiddleClick (a0)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

- mousePressEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QMouseEvent |

- moveTab (a0, a1)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | int |
  a1 | int |

  Move a widget's tab from first to second specified index and emit signal movedTab( int, int ) afterwards.

- movedTab (a0, a1)

  returns Nothing
  SIGNAL ("movedTab (int, int)")

  Argument | Type | Default
  --- | --- | ---
  a0 | int |
  a1 | int |

  A tab was moved from first to second index. This signal is only possible after you have called setTabReorderingEnabled( true ).

- receivedDropEvent (a0)

  returns Nothing
  SIGNAL ("receivedDropEvent (QDropEvent*)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QDropEvent |

  Received an event in the empty space beside tabbar. Usually creates a new tab. This signal is only possible after testCanDecode and positive accept result.

- receivedDropEvent (a0, a1)

  returns Nothing
  SIGNAL ("receivedDropEvent (QWidget*, QDropEvent*)")

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |
  a1 | QDropEvent |

  Received an drop event on given widget's tab. This signal is only possible after testCanDecode and positive accept result.

- receivedDropEvent (a0, a1)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | int |
  a1 | QDropEvent |

- removePage (w)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  w | QWidget |

  Removes the widget, reimplemented for internal reasons (keeping labels in sync). Deprecated since 4.0

- removeTab (index)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  index | int |

  Removes the widget, reimplemented for internal reasons (keeping labels in sync).

- resizeEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QResizeEvent |

- setAutomaticResizeTabs (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  If enable is true, tabs will be resized to the width of the tab bar.

  Does not work reliably with "QTabWidget* foo=new KTabWidget()" and if you change tabs via the tabbar or by accessing tabs directly.

- setCloseButtonEnabled (a0)

  returns Nothing
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  a0 | bool |

  If enabled, a close button is available for each tab. The signal KTabWidget.closeRequest() is emitted, if the close button has been clicked.

  @since 4.1

- setHoverCloseButton (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  If enable is true, a close button will be shown on mouse hover over tab icons which will emit signal closeRequest( QWidget * ) when pressed.

  Deprecated Use KTabWidget.setCloseButtonEnabled() instead.

- setHoverCloseButtonDelayed (delayed)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  delayed | bool |

  If delayed is true, a close button will be shown on mouse hover over tab icons after mouse double click delay else immediately.

  Deprecated Use KTabWidget.setCloseButtonEnabled() instead.

- setTabBarHidden (hide)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  hide | bool |

  If hide is true, the tabbar is hidden along with any corner widgets.

- setTabCloseActivatePrevious (previous)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  previous | bool |

  If previous is true, closing the current tab activates the previous active tab instead of the one to the right.

- setTabReorderingEnabled (enable)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  enable | bool |

  If enable is true, tab reordering with middle button will be enabled.

  Note that once enabled you shouldn't rely on previously queried currentPageIndex() or indexOf( QWidget * ) values anymore.

  You can connect to signal movedTab(int, int) which will notify you from which index to which index a tab has been moved.

- setTabText (a0, a1)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | int |
  a1 | QString |

  Reimplemented for internal reasons.

- setTabTextColor (index, color)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  index | int |
  color | QColor |

  Set the tab of the given widget to color. This is simply a convenience method for QTabBar.setTabTextColor.

- tabBarWidthForMaxChars (a0)

  returns int

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

- tabCloseActivatePrevious ( )

  returns bool

  Returns true if closing the current tab activates the previous actice tab instead of the one to the right.

- tabInserted (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

- tabRemoved (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

- tabText (a0)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

  Reimplemented for internal reasons.

- tabTextColor (index)

  returns QColor

  Argument | Type | Default
  --- | --- | ---
  index | int |

  Returns the tab color for the given widget. This is simply a convenience method for QTabBar.tabTextColor.

- testCanDecode (e, accept)

  returns Nothing
  Not implemented SIGNAL ("testCanDecode (const QDragMoveEvent*, bool&)")

  Argument | Type | Default
  --- | --- | ---
  e | QDragMoveEvent |
  accept | bool |

  Connect to this and set accept to true if you can and want to decode the event.

- wheelDelta (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | int |

- wheelEvent (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QWheelEvent |