Qt Jambi Home

com.trolltech.qt.gui
Class QHBoxLayout

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QLayout
                  extended by com.trolltech.qt.gui.QBoxLayout
                      extended by com.trolltech.qt.gui.QHBoxLayout
All Implemented Interfaces:
QLayoutItemInterface, QtJambiInterface

public class QHBoxLayout
extends QBoxLayout

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 Classes, Layouts Example

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QBoxLayout
QBoxLayout.Direction
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QLayout
QLayout.SizeConstraint
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QHBoxLayout()
          Constructs a new horizontal box.
QHBoxLayout(QWidget parent)
          Constructs a new top-level horizontal box with parent parent.
 
Method Summary
static QHBoxLayout fromNativePointer(QNativePointer nativePointer)
          This function returns the QHBoxLayout instance pointed to by nativePointer
 
Methods inherited from class com.trolltech.qt.gui.QBoxLayout
addItem, addLayout, addLayout, addSpacing, addStretch, addStretch, addStrut, addWidget, addWidget, count, direction, expandingDirections, hasHeightForWidth, heightForWidth, insertItem, insertLayout, insertLayout, insertSpacing, insertStretch, insertStretch, insertWidget, insertWidget, insertWidget, insertWidget, invalidate, itemAt, maximumSize, minimumHeightForWidth, minimumSize, setDirection, setGeometry, setSpacing, setStretchFactor, setStretchFactor, sizeHint, spacing, takeAt
 
Methods inherited from class com.trolltech.qt.gui.QLayout
activate, addChildLayout, addChildWidget, addWidget, alignment, alignmentRect, childEvent, closestAcceptableSize, contentsRect, controlTypes, geometry, getContentsMargins, indexOf, isEmpty, isEnabled, layout, menuBar, parentWidget, removeItem, removeWidget, setAlignment, setAlignment, setAlignment, setAlignment, setAlignment, setContentsMargins, setContentsMargins, setEnabled, setMargin, setMenuBar, setSizeConstraint, setWidgetSpacing, sizeConstraint, spacerItem, totalHeightForWidth, totalMaximumSize, totalMinimumSize, totalSizeHint, update, widget, widgetEvent, widgetSpacing
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QHBoxLayout

public QHBoxLayout(QWidget parent)

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


QHBoxLayout

public QHBoxLayout()

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

Method Detail

fromNativePointer

public static QHBoxLayout fromNativePointer(QNativePointer nativePointer)
This function returns the QHBoxLayout instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

Qt Jambi Home