• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEUI

KTabWidget Class Reference

A widget containing multiple tabs. More...

#include <ktabwidget.h>

Inheritance diagram for KTabWidget:

Inheritance graph
[legend]

List of all members.


Public Slots

virtual void moveTab (int, int)
virtual QT_MOC_COMPAT void removePage (QWidget *w)
virtual void removeTab (int index)
void setAutomaticResizeTabs (bool enable)
void setCloseButtonEnabled (bool)
QT_MOC_COMPAT void setHoverCloseButton (bool enable)
QT_MOC_COMPAT void setHoverCloseButtonDelayed (bool delayed)
void setTabCloseActivatePrevious (bool previous)
void setTabReorderingEnabled (bool enable)

Signals

void closeRequest (QWidget *)
void contextMenu (QWidget *, const QPoint &)
void contextMenu (const QPoint &)
void initiateDrag (QWidget *)
void mouseDoubleClick (QWidget *)
void mouseDoubleClick ()
void mouseMiddleClick (QWidget *)
void mouseMiddleClick ()
void movedTab (int, int)
void receivedDropEvent (QWidget *, QDropEvent *)
void receivedDropEvent (QDropEvent *)
void testCanDecode (const QDragMoveEvent *e, bool &accept)

Public Member Functions

bool automaticResizeTabs () const
KDE_DEPRECATED bool hoverCloseButton () const
KDE_DEPRECATED bool hoverCloseButtonDelayed () const
bool isCloseButtonEnabled () const
bool isTabBarHidden () const
bool isTabReorderingEnabled () const
 KTabWidget (QWidget *parent=0, Qt::WFlags flags=0)
void setTabBarHidden (bool hide)
void setTabText (int, const QString &)
void setTabTextColor (int index, const QColor &color)
bool tabCloseActivatePrevious () const
QString tabText (int) const
QColor tabTextColor (int index) const
virtual ~KTabWidget ()

Protected Slots

virtual void closeRequest (int)
virtual void contextMenu (int, const QPoint &)
void currentChanged (int)
virtual void initiateDrag (int)
virtual void mouseDoubleClick (int)
virtual void mouseMiddleClick (int)
virtual void receivedDropEvent (int, QDropEvent *)
virtual void wheelDelta (int)

Protected Member Functions

virtual void dragEnterEvent (QDragEnterEvent *)
virtual void dragMoveEvent (QDragMoveEvent *)
virtual void dropEvent (QDropEvent *)
virtual void mouseDoubleClickEvent (QMouseEvent *)
virtual void mousePressEvent (QMouseEvent *)
virtual void resizeEvent (QResizeEvent *)
int tabBarWidthForMaxChars (int)
virtual void tabInserted (int)
virtual void tabRemoved (int)
virtual void wheelEvent (QWheelEvent *)

Properties

bool automaticResizeTabs
bool closeButtonEnabled
bool hoverCloseButton
bool hoverCloseButtonDelayed
bool tabCloseActivatePrevious
bool tabReorderingEnabled

Detailed Description

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.

Definition at line 41 of file ktabwidget.h.


Constructor & Destructor Documentation

KTabWidget::KTabWidget ( QWidget *  parent = 0,
Qt::WFlags  flags = 0 
) [explicit]

Creates a new tab widget.

Parameters:
parent The parent widgets.
flags The Qt window flags
See also:
QWidget.

Definition at line 179 of file ktabwidget.cpp.

KTabWidget::~KTabWidget (  )  [virtual]

Destroys the tab widget.

Definition at line 202 of file ktabwidget.cpp.


Member Function Documentation

bool KTabWidget::automaticResizeTabs (  )  const

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

void KTabWidget::closeRequest ( int  index  )  [protected, virtual, slot]

Definition at line 605 of file ktabwidget.cpp.

void KTabWidget::closeRequest ( QWidget *   )  [signal]

The close button of a widget's tab was clicked.

This signal is only possible after you have called setCloseButtonEnabled( true ).

void KTabWidget::contextMenu ( int  index,
const QPoint &  point 
) [protected, virtual, slot]

Definition at line 465 of file ktabwidget.cpp.

void KTabWidget::contextMenu ( QWidget *  ,
const QPoint &   
) [signal]

The right mouse button was pressed over a widget.

void KTabWidget::contextMenu ( const QPoint &   )  [signal]

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

void KTabWidget::currentChanged ( int  idx  )  [protected, slot]

Reimplemented from QTabWidget.

Definition at line 626 of file ktabwidget.cpp.

void KTabWidget::dragEnterEvent ( QDragEnterEvent *  event  )  [protected, virtual]

Definition at line 356 of file ktabwidget.cpp.

void KTabWidget::dragMoveEvent ( QDragMoveEvent *  event  )  [protected, virtual]

Definition at line 371 of file ktabwidget.cpp.

void KTabWidget::dropEvent ( QDropEvent *  event  )  [protected, virtual]

Definition at line 386 of file ktabwidget.cpp.

KDE_DEPRECATED bool KTabWidget::hoverCloseButton (  )  const

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

Deprecated:
Use KTabWidget::isCloseButtonEnabled() instead.

KDE_DEPRECATED bool KTabWidget::hoverCloseButtonDelayed (  )  const

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

Deprecated:
Use KTabWidget::isCloseButtonEnabled() instead.

void KTabWidget::initiateDrag ( int  index  )  [protected, virtual, slot]

Definition at line 460 of file ktabwidget.cpp.

void KTabWidget::initiateDrag ( QWidget *   )  [signal]

Request to start a drag operation on the given tab.

bool KTabWidget::isCloseButtonEnabled (  )  const

Returns true if the close button is shown on tabs.

Since:
4.1

Definition at line 574 of file ktabwidget.cpp.

bool KTabWidget::isTabBarHidden (  )  const

Returns true if the tabbar is hidden.

Definition at line 248 of file ktabwidget.cpp.

bool KTabWidget::isTabReorderingEnabled (  )  const

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

Definition at line 268 of file ktabwidget.cpp.

void KTabWidget::mouseDoubleClick ( int  index  )  [protected, virtual, slot]

Definition at line 470 of file ktabwidget.cpp.

void KTabWidget::mouseDoubleClick ( QWidget *   )  [signal]

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

void KTabWidget::mouseDoubleClick (  )  [signal]

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

void KTabWidget::mouseDoubleClickEvent ( QMouseEvent *  event  )  [protected, virtual]

Definition at line 425 of file ktabwidget.cpp.

void KTabWidget::mouseMiddleClick ( int  index  )  [protected, virtual, slot]

Definition at line 475 of file ktabwidget.cpp.

void KTabWidget::mouseMiddleClick ( QWidget *   )  [signal]

A middle mouse button click was performed over the widget.

void KTabWidget::mouseMiddleClick (  )  [signal]

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

void KTabWidget::mousePressEvent ( QMouseEvent *  event  )  [protected, virtual]

Definition at line 438 of file ktabwidget.cpp.

void KTabWidget::movedTab ( int  ,
int   
) [signal]

A tab was moved from first to second index.

This signal is only possible after you have called setTabReorderingEnabled( true ).

void KTabWidget::moveTab ( int  from,
int  to 
) [virtual, slot]

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

Definition at line 480 of file ktabwidget.cpp.

void KTabWidget::receivedDropEvent ( int  index,
QDropEvent *  event 
) [protected, virtual, slot]

Definition at line 455 of file ktabwidget.cpp.

void KTabWidget::receivedDropEvent ( QWidget *  ,
QDropEvent *   
) [signal]

Received an drop event on given widget's tab.

This signal is only possible after testCanDecode and positive accept result.

void KTabWidget::receivedDropEvent ( QDropEvent *   )  [signal]

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.

void KTabWidget::removePage ( QWidget *  w  )  [virtual, slot]

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

Deprecated:
since 4.0

Definition at line 513 of file ktabwidget.cpp.

void KTabWidget::removeTab ( int  index  )  [virtual, slot]

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

Reimplemented from QTabWidget.

Definition at line 529 of file ktabwidget.cpp.

void KTabWidget::resizeEvent ( QResizeEvent *  event  )  [protected, virtual]

Definition at line 610 of file ktabwidget.cpp.

void KTabWidget::setAutomaticResizeTabs ( bool  enable  )  [slot]

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.

Definition at line 579 of file ktabwidget.cpp.

void KTabWidget::setCloseButtonEnabled ( bool  enable  )  [slot]

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

Definition at line 569 of file ktabwidget.cpp.

void KTabWidget::setHoverCloseButton ( bool  enable  )  [slot]

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.

Definition at line 545 of file ktabwidget.cpp.

void KTabWidget::setHoverCloseButtonDelayed ( bool  delayed  )  [slot]

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.

Definition at line 557 of file ktabwidget.cpp.

void KTabWidget::setTabBarHidden ( bool  hide  ) 

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

Definition at line 232 of file ktabwidget.cpp.

void KTabWidget::setTabCloseActivatePrevious ( bool  previous  )  [slot]

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

Definition at line 273 of file ktabwidget.cpp.

void KTabWidget::setTabReorderingEnabled ( bool  enable  )  [slot]

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.

Definition at line 263 of file ktabwidget.cpp.

void KTabWidget::setTabText ( int  index,
const QString &  text 
)

Reimplemented for internal reasons.

Reimplemented from QTabWidget.

Definition at line 332 of file ktabwidget.cpp.

void KTabWidget::setTabTextColor ( int  index,
const QColor &  color 
)

Set the tab of the given widget to color.

This is simply a convenience method for QTabBar::setTabTextColor.

Definition at line 253 of file ktabwidget.cpp.

int KTabWidget::tabBarWidthForMaxChars ( int  maxLength  )  [protected]

Definition at line 283 of file ktabwidget.cpp.

bool KTabWidget::tabCloseActivatePrevious (  )  const

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

void KTabWidget::tabInserted ( int  idx  )  [protected, virtual]

Reimplemented from QTabWidget.

Definition at line 616 of file ktabwidget.cpp.

void KTabWidget::tabRemoved ( int  idx  )  [protected, virtual]

Reimplemented from QTabWidget.

Definition at line 621 of file ktabwidget.cpp.

QString KTabWidget::tabText ( int  index  )  const

Reimplemented for internal reasons.

virtual void insertTab( QWidget *, const QString &, int index = -1 );

! Reimplemented for internal reasons.

virtual void insertTab( QWidget *child, const QIcon& iconset, const QString &label, int index = -1 ); ! Reimplemented for internal reasons.

virtual void insertTab( QWidget *, QTab *, int index = -1 ); Reimplemented for internal reasons.

Definition at line 312 of file ktabwidget.cpp.

QColor KTabWidget::tabTextColor ( int  index  )  const

Returns the tab color for the given widget.

This is simply a convenience method for QTabBar::tabTextColor.

Definition at line 258 of file ktabwidget.cpp.

void KTabWidget::testCanDecode ( const QDragMoveEvent *  e,
bool &  accept 
) [signal]

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

void KTabWidget::wheelDelta ( int  delta  )  [protected, virtual, slot]

Definition at line 408 of file ktabwidget.cpp.

void KTabWidget::wheelEvent ( QWheelEvent *  event  )  [protected, virtual]

Definition at line 397 of file ktabwidget.cpp.


Property Documentation

bool KTabWidget::automaticResizeTabs [read, write]

Definition at line 49 of file ktabwidget.h.

bool KTabWidget::closeButtonEnabled [read, write]

Definition at line 47 of file ktabwidget.h.

bool KTabWidget::hoverCloseButton [read, write]

Definition at line 45 of file ktabwidget.h.

bool KTabWidget::hoverCloseButtonDelayed [read, write]

Definition at line 46 of file ktabwidget.h.

bool KTabWidget::tabCloseActivatePrevious [read, write]

Definition at line 48 of file ktabwidget.h.

bool KTabWidget::tabReorderingEnabled [read, write]

Definition at line 44 of file ktabwidget.h.


The documentation for this class was generated from the following files:
  • ktabwidget.h
  • ktabwidget.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal