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  · 

QHBoxLayout Class

The QHBoxLayout class lines up widgets horizontally. More...

 #include <QHBoxLayout>

Inherits: QBoxLayout.

Public Types

enum SizeConstraint { SetDefaultConstraint, SetFixedSize, SetMinimumSize, SetMaximumSize, SetMinAndMaxSize, SetNoConstraint }

Properties

  • 1 property inherited from QObject

Public Functions

QHBoxLayout()
QHBoxLayout(QWidget * parent)
QLayout(QWidget * parent)
QLayout()
QLayoutItem(Qt::Alignment alignment = 0)
~QHBoxLayout()
virtual ~QLayoutItem()
bool activate()
virtual void addItem(QLayoutItem * item) = 0
void addWidget(QWidget * w)
Qt::Alignment alignment() const
QMargins contentsMargins() const
QRect contentsRect() const
virtual QSizePolicy::ControlTypes controlTypes() const
virtual int count() const = 0
virtual Qt::Orientations expandingDirections() const
virtual QRect geometry() const
void getContentsMargins(int * left, int * top, int * right, int * bottom) const
virtual bool hasHeightForWidth() const
virtual int heightForWidth(int w) const
virtual int indexOf(QWidget * widget) const
virtual void invalidate()
virtual bool isEmpty() const
bool isEnabled() const
virtual QLayoutItem * itemAt(int index) const = 0
virtual QLayout * layout()
virtual QSize maximumSize() const
QWidget * menuBar() const
virtual int minimumHeightForWidth(int w) const
virtual QSize minimumSize() const
QWidget * parentWidget() const
void removeItem(QLayoutItem * item)
void removeWidget(QWidget * widget)
bool setAlignment(QWidget * w, Qt::Alignment alignment)
void setAlignment(Qt::Alignment alignment)
bool setAlignment(QLayout * l, Qt::Alignment alignment)
void setContentsMargins(int left, int top, int right, int bottom)
void setContentsMargins(const QMargins & margins)
void setEnabled(bool enable)
virtual void setGeometry(const QRect & r)
void setMenuBar(QWidget * widget)
void setSizeConstraint(SizeConstraint)
void setSpacing(int)
SizeConstraint sizeConstraint() const
virtual QSize sizeHint() const = 0
virtual QSpacerItem * spacerItem()
int spacing() const
virtual QLayoutItem * takeAt(int index) = 0
void update()
virtual QWidget * widget()
  • 33 public functions inherited from QBoxLayout
  • 31 public functions inherited from QObject

Static Public Members

QSize closestAcceptableSize(const QWidget * widget, const QSize & size)
  • 11 static public members inherited from QObject

Protected Functions

void addChildLayout(QLayout * l)
void addChildWidget(QWidget * w)
QRect alignmentRect(const QRect & r) const
virtual void childEvent(QChildEvent * e)
  • 9 protected functions inherited from QObject

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 2 signal inherited from QObject

Detailed Description

The QHBoxLayout class lines up widgets horizontally.

This class is used to construct horizontal box layout objects. See QBoxLayout for details.

The simplest use of the class is like this:

     QWidget *window = new QWidget;
     QPushButton *button1 = new QPushButton("One");
     QPushButton *button2 = new QPushButton("Two");
     QPushButton *button3 = new QPushButton("Three");
     QPushButton *button4 = new QPushButton("Four");
     QPushButton *button5 = new QPushButton("Five");

     QHBoxLayout *layout = new QHBoxLayout;
     layout->addWidget(button1);
     layout->addWidget(button2);
     layout->addWidget(button3);
     layout->addWidget(button4);
     layout->addWidget(button5);

     window->setLayout(layout);
     window->show();

First, we create the widgets we want in the layout. Then, we create the QHBoxLayout object and add the widgets into the layout. Finally, we call QWidget::setLayout() to install the QHBoxLayout object onto the widget. At that point, the widgets in the layout are reparented to have window as their parent.

Horizontal box layout with five child widgets

See also QVBoxLayout, QGridLayout, QStackedLayout, Layout Management, and Basic Layouts Example.

Member Function Documentation

QHBoxLayout::QHBoxLayout()

Constructs a new horizontal box. You must add it to another layout.

QHBoxLayout::QHBoxLayout(QWidget * parent)

Constructs a new top-level horizontal box with parent parent.

QHBoxLayout::~QHBoxLayout()

Destroys this box layout.

The layout's widgets aren't destroyed.

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 5.0-snapshot
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