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  ·  Fonctions  · 

QGroupBox Class Reference

The QGroupBox widget provides a group box frame with a title. More...

#include <qgroupbox.h>

Inherits QFrame.

Inherited by QButtonGroup, QHGroupBox and QVGroupBox.

List of all member functions.

Public Members

Properties

  • Alignment alignment - the alignment of the group box title
  • int columns - the number of columns or rows (depending on \l QGroupBox::orientation) in the group box
  • Orientation orientation - the current orientation of the group box
  • QString title - the group box title text

Detailed Description

The QGroupBox widget provides a group box frame with a title.

A group box provides a frame, a title and a keyboard shortcut, and displays various other widgets inside itself. The title is on top, the keyboard shortcut moves keyboard focus to one of the group box's child widgets, and the child widgets are arranged in an array inside the frame.

The simplest way to use it is to create a group box with the desired number of columns (or rows) and orientation, and then just create widgets with the group box as parent.

However, it is also possible to change the orientation() and number of columns() after construction, or to ignore all the automatic layout support and manage all that yourself. You can add 'empty' spaces to the group box with addSpace().

QGroupBox also lets you set the title() (normally set in the constructor) and the title's alignment().

You can change the spacing used by the group box with setInsideMargin() and setInsideSpacing().

See also QButtonGroup, Widget Appearance and Style, Layout Management and Organizers.


Member Function Documentation

QGroupBox::QGroupBox ( QWidget * parent = 0, const char * name = 0 )

Constructs a group box widget with no title.

The parent and name arguments are passed to the QWidget constructor.

This constructor does not do automatic layout.

QGroupBox::QGroupBox ( const QString & title, QWidget * parent = 0, const char * name = 0 )

Constructs a group box with the title title.

The parent and name arguments are passed to the QWidget constructor.

This constructor does not do automatic layout.

QGroupBox::QGroupBox ( int strips, Orientation orientation, QWidget * parent = 0, const char * name = 0 )

Constructs a group box with no title. Child widgets will be arranged in strips rows or columns (depending on orientation).

The parent and name arguments are passed to the QWidget constructor.

QGroupBox::QGroupBox ( int strips, Orientation orientation, const QString & title, QWidget * parent = 0, const char * name = 0 )

Constructs a group box titled title. Child widgets will be arranged in strips rows or columns (depending on orientation).

The parent and name arguments are passed to the QWidget constructor.

void QGroupBox::addSpace ( int size )

Adds an empty cell at the next free position. If size is greater than 0, the empty cell has a fixed height or width. If the group box is oriented horizontally, the empty cell has a fixed height; if oriented vertically, it has a fixed width.

Use this method to separate the widgets in the group box or to skip the next free cell. For performance reasons, call this method after calling setColumnLayout() or by changing the QGroupBox::columns or QGroupBox::orientation properties. It is generally a good idea to call these methods first (if needed at all), and insert the widgets and spaces afterwards.

int QGroupBox::alignment () const

Returns the alignment of the group box title. See the "alignment" property for details.

int QGroupBox::columns () const

Returns the number of columns or rows (depending on QGroupBox::orientation) in the group box. See the "columns" property for details.

int QGroupBox::insideMargin () const

Returns the width of the blank spacing between the items in the group and the frame of the group.

Only applies if the group box has a defined orientation.

The default is about 11.

See also setInsideMargin() and orientation.

int QGroupBox::insideSpacing () const

Returns the width of the blank spacing between each of the items in the group.

Only applies if the group box has a defined orientation.

The default is about 5.

See also setInsideSpacing() and orientation.

Orientation QGroupBox::orientation () const

Returns the current orientation of the group box. See the "orientation" property for details.

void QGroupBox::setAlignment ( int ) [virtual]

Sets the alignment of the group box title. See the "alignment" property for details.

void QGroupBox::setColumnLayout ( int strips, Orientation direction ) [virtual]

Changes the layout of the group box. This function is useful only in combination with the default constructor that does not take any layout information. This function will put all existing children in the new layout. It is not good Qt programming style to call this function after children have been inserted. Sets the number of columns or rows to be strips, depending on direction.

See also orientation and columns.

Example: chart/optionsform.cpp.

void QGroupBox::setColumns ( int )

Sets the number of columns or rows (depending on QGroupBox::orientation) in the group box. See the "columns" property for details.

void QGroupBox::setInsideMargin ( int m )

Sets the the width of the blank spacing between each of the items in the group to m pixels.

See also insideSpacing().

void QGroupBox::setInsideSpacing ( int s )

Sets the width of the blank spacing between each of the items in the group to s pixels.

void QGroupBox::setOrientation ( Orientation )

Sets the current orientation of the group box. See the "orientation" property for details.

void QGroupBox::setTitle ( const QString & ) [virtual]

Sets the group box title text. See the "title" property for details.

QString QGroupBox::title () const

Returns the group box title text. See the "title" property for details.


Property Documentation

Alignment alignment

This property holds the alignment of the group box title.

The title is always placed on the upper frame line; however, the horizontal alignment can be specified by the alignment parameter.

The alignment is one of the following flags:

  • AlignAuto aligns the title accroding to the language, usually left.
  • AlignLeft aligns the title text to the left.
  • AlignRight aligns the title text to the right.
  • AlignHCenter aligns the title text centered.

The default alignment is AlignAuto.

See also Qt::AlignmentFlags.

Set this property's value with setAlignment() and get this property's value with alignment().

int columns

This property holds the number of columns or rows (depending on QGroupBox::orientation) in the group box.

Usually it is not a good idea to set this property because it is slow (it does a complete layout). It is better to set the number of columns directly in the constructor.

Set this property's value with setColumns() and get this property's value with columns().

Orientation orientation

This property holds the current orientation of the group box.

A horizontal group box arranges it's children in columns, while a vertical group box arranges them in rows. Thus, a horizontal group box with only one column will arrange the children vertically in that column.

Usually it is not a good idea to set this property because it is slow (it does a complete layout). It is better to set the orientation directly in the constructor.

Set this property's value with setOrientation() and get this property's value with orientation().

QString title

This property holds the group box title text.

The group box title text will have a focus-change keyboard accelerator if the title contains &, followed by a letter.

      g->setTitle( "&User information" );
  
This produces "User information" with the U underlined; Alt+U moves the keyboard focus to the group box.

There is no default title text.

Set this property's value with setTitle() and get this property's value with title().


This file is part of the Qt toolkit. Copyright © 1995-2002 Trolltech. All Rights Reserved.

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 94
  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. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 47
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 12
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le blog Digia au hasard

Logo

Une nouvelle ère d'IHM 3D pour les automobiles

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. 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 3.0
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