Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QToolBox Class Reference
[QtGui module]

The QToolBox class provides a column of tabbed widget items. More...

 #include <QToolBox>

Inherits QFrame.

Properties

  • 6 properties inherited from QFrame
  • 55 properties inherited from QWidget
  • 1 property inherited from QObject

Public Functions

  • 13 public functions inherited from QFrame
  • 195 public functions inherited from QWidget
  • 29 public functions inherited from QObject
  • 12 public functions inherited from QPaintDevice

Public Slots

  • 19 public slots inherited from QWidget
  • 1 public slot inherited from QObject

Signals

Protected Functions

  • 38 protected functions inherited from QWidget
  • 7 protected functions inherited from QObject
  • 1 protected function inherited from QPaintDevice

Additional Inherited Members

  • 4 static public members inherited from QWidget
  • 5 static public members inherited from QObject
  • 1 protected slot inherited from QWidget

Detailed Description

The QToolBox class provides a column of tabbed widget items.

A toolbox is a widget that displays a column of tabs one above the other, with the current item displayed below the current tab. Every tab has an index position within the column of tabs. A tab's item is a QWidget.

Each item has an itemText(), an optional itemIcon(), an optional itemToolTip(), and a widget(). The item's attributes can be changed with setItemText(), setItemIcon(), and setItemToolTip(). Each item can be enabled or disabled individually with setItemEnabled().

Items are added using addItem(), or inserted at particular positions using insertItem(). The total number of items is given by count(). Items can be deleted with delete, or removed from the toolbox with removeItem(). Combining removeItem() and insertItem() allows you to move items to different positions.

The index of the current item widget is returned by currentIndex(), and set with setCurrentIndex(). The index of a particular item can be found using indexOf(), and the item at a given index is returned by item().

The currentChanged() signal is emitted when the current item is changed.

See also QTabWidget.


Property Documentation

count : const int

This property holds the number of items contained in the toolbox.

Access functions:

  • int count () const

currentIndex : int

This property holds the index of the current item, or -1 if the toolbox is empty.

Access functions:

  • int currentIndex () const
  • void setCurrentIndex ( int index )

See also indexOf() and widget().


Member Function Documentation

QToolBox::QToolBox ( QWidget * parent = 0, Qt::WindowFlags f = 0 )

Constructs a new toolbox with the given parent and the flags, f.

QToolBox::~QToolBox ()

Destroys the toolbox.

int QToolBox::addItem ( QWidget * widget, const QIcon & iconSet, const QString & text )

Adds the widget in a new tab at bottom of the toolbox. The new tab's text is set to text, and the iconSet is displayed to the left of the text. Returns the new tab's index.

int QToolBox::addItem ( QWidget * w, const QString & text )

This is an overloaded member function, provided for convenience.

Adds the widget w in a new tab at bottom of the toolbox. The new tab's text is set to text. Returns the new tab's index.

void QToolBox::currentChanged ( int index )   [signal]

This signal is emitted when the current item is changed. The new current item's index is passed in index, or -1 if there is no current item.

QWidget * QToolBox::currentWidget () const

Returns a pointer to the current widget, or 0 if there is no such item.

See also currentIndex() and setCurrentWidget().

int QToolBox::indexOf ( QWidget * widget ) const

Returns the index of widget, or -1 if the item does not exist.

int QToolBox::insertItem ( int index, QWidget * widget, const QIcon & icon, const QString & text )

Inserts the widget at position index, or at the bottom of the toolbox if index is out of range. The new item's text is set to text, and the icon is displayed to the left of the text. Returns the new item's index.

int QToolBox::insertItem ( int index, QWidget * widget, const QString & text )

This is an overloaded member function, provided for convenience.

Inserts the widget at position index, or at the bottom of the toolbox if index is out of range. The new item's text is set to text. Returns the new item's index.

bool QToolBox::isItemEnabled ( int index ) const

Returns true if the item at position index is enabled; otherwise returns false.

QIcon QToolBox::itemIcon ( int index ) const

Returns the icon of the item at position index, or a null icon if index is out of range.

See also setItemIcon().

void QToolBox::itemInserted ( int index )   [virtual protected]

This virtual handler is called after a new item was added or inserted at position index.

See also itemRemoved().

void QToolBox::itemRemoved ( int index )   [virtual protected]

This virtual handler is called after an item was removed from position index.

See also itemInserted().

QString QToolBox::itemText ( int index ) const

Returns the text of the item at position index, or an empty string if index is out of range.

See also setItemText().

QString QToolBox::itemToolTip ( int index ) const

Returns the tooltip of the item at position index, or an empty string if index is out of range.

See also setItemToolTip().

void QToolBox::removeItem ( int index )

Removes the item at position index from the toolbox. Note that the widget is not deleted.

void QToolBox::setCurrentWidget ( QWidget * widget )   [slot]

Makeswidget the current widget. The widget must be an item in this tool box.

See also addItem(), setCurrentIndex(), and currentWidget().

void QToolBox::setItemEnabled ( int index, bool enabled )

If enabled is true then the item at position index is enabled; otherwise the item at position index is disabled.

See also isItemEnabled().

void QToolBox::setItemIcon ( int index, const QIcon & icon )

Sets the icon of the item at position index to icon.

See also itemIcon().

void QToolBox::setItemText ( int index, const QString & text )

Sets the text of the item at position index to text.

If the provided text contains an ampersand character ('&'), a mnemonic is automatically created for it. The character that follows the '&' will be used as the shortcut key. Any previous mnemonic will be overwritten, or cleared if no mnemonic is defined by the text. See the QShortcut documentation for details (to display an actual ampersand, use '&&').

See also itemText().

void QToolBox::setItemToolTip ( int index, const QString & toolTip )

Sets the tooltip of the item at position index to toolTip.

See also itemToolTip().

QWidget * QToolBox::widget ( int index ) const

Returns the widget at position index, or 0 if there is no such item.


Member Function Documentation

QToolBox::QToolBox ( QWidget * parent, const char * name, Qt::WindowFlags f = 0 )

Constructs a toolbox called name with parent parent and flags f.

QWidget * QToolBox::currentItem () const

Use widget(currentIndex()) instead.

See also setCurrentItem().

QWidget * QToolBox::item ( int index ) const

Use widget() instead.

QIcon QToolBox::itemIconSet ( int index ) const

Use itemIcon() instead.

See also setItemIconSet().

QString QToolBox::itemLabel ( int index ) const

Use itemText() instead.

See also setItemLabel().

int QToolBox::margin () const

Returns the with of the the margin around the contents of the widget.

Use QWidget::getContentsMargins() instead.

See also setMargin() and QWidget::getContentsMargins().

int QToolBox::removeItem ( QWidget * widget )

This is an overloaded member function, provided for convenience.

Use toolbox->removeItem(toolbox->indexOf(widget)) instead.

void QToolBox::setCurrentItem ( QWidget * widget )

Use setCurrentIndex(indexOf(widget)) instead.

See also currentItem().

void QToolBox::setItemIconSet ( int index, const QIcon & icon )

Use setItemIcon() instead.

See also itemIconSet().

void QToolBox::setItemLabel ( int index, const QString & text )

Use setItemText() instead.

See also itemLabel().

void QToolBox::setMargin ( int margin )

Sets the width of the margin around the contents of the widget to margin.

Use QWidget::setContentsMargins() instead.

See also margin() and QWidget::setContentsMargins().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web