Home · Modules · Classes · Namespaces · Functions

QxtTabWidget Class Reference
[QxtGui module]

The QxtTabWidget class is an extended QTabWidget. More...

    #include <QxtTabWidget>

Inherits QTabWidget.

Public Functions

Signals

Protected Functions

Additional Inherited Members


Detailed Description

The QxtTabWidget class is an extended QTabWidget.

QxtTabWidget provides some convenience for handling tab specific context menus and animations.

Example usage:

    QxtTabWidget* tabWidget = new QxtTabWidget();
    tabWidget->addTab(tab0, "1");
    tabWidget->addTab(tab1, "2");

    QList<QAction*> actions0;
    actions0 << new QAction("Quisque", tab0) << new QAction("Aenean", tab0);
    QList<QAction*> actions1;
    actions1 << new QAction("Phasellus", tab1) << new QAction("Maecenas", tab1);

    tabWidget->setTabContextMenuPolicy(Qt::ActionsContextMenu);
    tabWidget->addTabActions(0, actions0);
    tabWidget->addTabActions(1, actions1);

"QxtTabWidget in WindowsXP style."


Member Function Documentation

QxtTabWidget::QxtTabWidget ( QWidget * parent = 0 )

Constructs a new QxtTabWidget with parent.

QxtTabWidget::~QxtTabWidget ()   [virtual]

Destructs the tab widget.

void QxtTabWidget::addTabAction ( int index, QAction * action )

Appends the action to the list of actions of the tab at index.

See also removeTabAction(), insertTabAction(), and tabActions().

QAction * QxtTabWidget::addTabAction ( int index, const QString & text )

This convenience function creates a new action with text. The function adds the newly created action to the list of actions of the tab at index, and returns it.

See also addTabAction().

QAction * QxtTabWidget::addTabAction ( int index, const QIcon & icon, const QString & text )

This convenience function creates a new action with icon and text. The function adds the newly created action to the list of actions of the tab at index, and returns it.

See also addTabAction().

QAction * QxtTabWidget::addTabAction ( int index, const QString & text, const QObject * receiver, const char * member, const QKeySequence & shortcut = 0 )

This convenience function creates a new action with text and an optional shortcut. The action's triggered() signal is connected to the receiver's member slot. The function adds the newly created action to the list of actions of the tab at index, and returns it.

Note: In order to make it possible for the shortcut to work even when the context menu is not open, the action must be added to a visible widget. The corresponding tab is a good alternative.

    QWidget* tab = createNewTab();
    tabWidget->addTab(tab, title);
    QAction* action = tabWidget->addTabAction(index, tr("Close"), this, SLOT(closeCurrentTab()), tr("Ctrl+W"));
    tab->addAction(act);

See also addTabAction() and QWidget::addAction().

QAction * QxtTabWidget::addTabAction ( int index, const QIcon & icon, const QString & text, const QObject * receiver, const char * member, const QKeySequence & shortcut = 0 )

This convenience function creates a new action with icon, text and an optional shortcut. The action's triggered() signal is connected to the receiver's member slot. The function adds the newly created action to the list of actions of the tab at index, and returns it.

See also addTabAction().

void QxtTabWidget::addTabActions ( int index, QList<QAction *> actions )

Appends the actions to the list of actions of the tab at index.

See also removeTabAction() and addTabAction().

bool QxtTabWidget::alwaysShowTabBar () const

See also setAlwaysShowTabBar().

void QxtTabWidget::clearTabActions ( int index )

Clears the list of actions of the tab at index.

Note: Only actions owned by the tab widget are deleted.

See also removeTabAction() and addTabAction().

void QxtTabWidget::insertTabAction ( int index, QAction * before, QAction * action )

Inserts the action to the list of actions of the tab at index, before the action before. It appends the action if before is 0.

See also removeTabAction(), addTabAction(), tabContextMenuPolicy, and tabActions().

void QxtTabWidget::insertTabActions ( int index, QAction * before, QList<QAction *> actions )

Inserts the actions to the list of actions of the tab at index, before the action before. It appends the action if before is 0.

See also removeAction(), QMenu, insertAction(), and contextMenuPolicy.

void QxtTabWidget::removeTabAction ( int index, QAction * action )

Removes the action action from the list of actions of the tab at index.

Note: The removed action is not deleted.

See also insertTabAction(), tabActions(), and insertTabAction().

void QxtTabWidget::setAlwaysShowTabBar ( bool always )

See also alwaysShowTabBar().

void QxtTabWidget::setTabAnimation ( int index, QMovie * animation, bool start = true )

Sets the animation of the tab at index and optionally start the animation.

See also tabAnimation().

void QxtTabWidget::setTabAnimation ( int index, const QString & fileName, bool start = true )

This is an overloaded member function, provided for convenience.

The QMovie animation is constructed from fileName with this as parent. The animation is started if start is true.

See also setTabAnimation().

void QxtTabWidget::setTabContextMenuPolicy ( Qt::ContextMenuPolicy policy )

See also tabContextMenuPolicy().

QList<QAction *> QxtTabWidget::tabActions ( int index ) const

Returns the (possibly empty) list of actions for the tab at index.

See also tabContextMenuPolicy, insertTabAction(), and removeTabAction().

QMovie * QxtTabWidget::tabAnimation ( int index ) const

Returns the animation of the tab at index or 0 if no animation has been set.

See also setTabAnimation().

void QxtTabWidget::tabContextMenuEvent ( int index, QContextMenuEvent * event )   [virtual protected]

This event handler, for event event, can be reimplemented in a subclass to receive context menu events for the tab at index.

The handler is called when tabContextMenuPolicy is Qt::DefaultContextMenu.

The default implementation ignores the context menu event.

See also tabContextMenuPolicy and tabContextMenuRequested().

Qt::ContextMenuPolicy QxtTabWidget::tabContextMenuPolicy () const

See also setTabContextMenuPolicy().

void QxtTabWidget::tabContextMenuRequested ( int index, const QPoint & globalPos )   [signal]

This signal is emitted whenever the context menu is requested over tab at index at globalPos.

QMovie * QxtTabWidget::takeTabAnimation ( int index )

Removes the animation of the tab at index and returns it.

See also tabAnimation().


Copyright © 2007-2010 Qxt Foundation
Qxt 0.6.1