|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QLayout
com.trolltech.qt.gui.QBoxLayout
public class QBoxLayout
The QBoxLayout
class lines up child widgets horizontally or vertically. QBoxLayout
takes the space it gets (from its parent layout or from the parentWidget()
), divides it up into a row of boxes, and makes each managed widget fill one box.
QBoxLayout
's orientation is Qt::Horizontal
the boxes are placed in a row, with suitable sizes. Each widget (or other box) will get at least its minimum size and at most its maximum size. Any excess space is shared according to the stretch factors (more about that below). QBoxLayout
's orientation is Qt::Vertical
, the boxes are placed in a column, again with suitable sizes. The easiest way to create a QBoxLayout
is to use one of the convenience classes, e.g. QHBoxLayout
(for Qt::Horizontal
boxes) or QVBoxLayout
(for Qt::Vertical
boxes). You can also use the QBoxLayout
constructor directly, specifying its direction as LeftToRight
, RightToLeft
, TopToBottom
, or BottomToTop
.
If the QBoxLayout
is not the top-level layout (i.e. it is not managing all of the widget's area and children), you must add it to its parent layout before you can do anything with it. The normal way to add a layout is by calling parentLayout->addLayout()
.
Once you have done this, you can add boxes to the QBoxLayout
using one of four functions:
addWidget()
to add a widget to the QBoxLayout
and set the widget's stretch factor. (The stretch factor is along the row of boxes.)addSpacing()
to create an empty box; this is one of the functions you use to create nice and spacious dialogs. See below for ways to set margins.addStretch()
to create an empty, stretchable box.addLayout()
to add a box containing another QLayout
to the row and set that layout's stretch factor.insertWidget()
, insertSpacing()
, insertStretch()
or insertLayout()
to insert a box at a specified position in the layout. QBoxLayout
also includes two margin widths:
setContentsMargins()
sets the width of the outer border on each side of the widget. This is the width of the reserved space along each of the QBoxLayout
's four sides.setSpacing()
sets the width between neighboring boxes. (You can use addSpacing()
to get more space at a particular spot.)To remove a widget from a layout, call removeWidget()
. Calling QWidget::hide()
on a widget also effectively removes the widget from the layout until QWidget::show()
is called.
You will almost always want to use QVBoxLayout
and QHBoxLayout
rather than QBoxLayout
because of their convenient constructors.
QGridLayout
, QStackedLayout
, and Layout Classes.
Nested Class Summary | |
---|---|
static class |
QBoxLayout.Direction
This enum describes the direction of the timeline when in Running state. |
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QLayout |
---|
QLayout.SizeConstraint |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QBoxLayout(QBoxLayout.Direction arg__1)
Constructs a new QBoxLayout with direction dir and parent widget parent. |
|
QBoxLayout(QBoxLayout.Direction arg__1,
QWidget parent)
Constructs a new QBoxLayout with direction dir and parent widget parent. |
Method Summary | |
---|---|
void |
addLayout(QLayout layout)
Adds layout to the end of the box, with serial stretch factor stretch. |
void |
addLayout(QLayout layout,
int stretch)
Adds layout to the end of the box, with serial stretch factor stretch. |
void |
addSpacerItem(QSpacerItem spacerItem)
Adds spacerItem to the end of this box layout. |
void |
addSpacing(int size)
Adds a non-stretchable space (a QSpacerItem ) with size size to the end of this box layout. |
void |
addStretch()
Adds a stretchable space (a QSpacerItem ) with zero minimum size and stretch factor stretch to the end of this box layout. |
void |
addStretch(int stretch)
Adds a stretchable space (a QSpacerItem ) with zero minimum size and stretch factor stretch to the end of this box layout. |
void |
addStrut(int arg__1)
Limits the perpendicular dimension of the box (e. |
void |
addWidget(QWidget arg__1,
int stretch,
Qt.Alignment alignment)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment. |
void |
addWidget(QWidget arg__1,
int stretch,
Qt.AlignmentFlag[] alignment)
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment. |
QBoxLayout.Direction |
direction()
Returns the direction of the box. |
protected void |
insertItem(int index,
QLayoutItemInterface arg__2)
Inserts item into this box layout at position index. |
void |
insertLayout(int index,
QLayout layout)
Inserts layout at position index, with stretch factor stretch. |
void |
insertLayout(int index,
QLayout layout,
int stretch)
Inserts layout at position index, with stretch factor stretch. |
void |
insertSpacerItem(int index,
QSpacerItem spacerItem)
Inserts spacerItem at position index, with zero minimum size and stretch factor. |
void |
insertSpacing(int index,
int size)
Inserts a non-stretchable space (a QSpacerItem ) at position index, with size size. |
void |
insertStretch(int index)
Inserts a stretchable space (a QSpacerItem ) at position index, with zero minimum size and stretch factor stretch. |
void |
insertStretch(int index,
int stretch)
Inserts a stretchable space (a QSpacerItem ) at position index, with zero minimum size and stretch factor stretch. |
void |
insertWidget(int index,
QWidget widget)
Inserts widget at position index, with stretch factor stretch and alignment alignment. |
void |
insertWidget(int index,
QWidget widget,
int stretch)
Inserts widget at position index, with stretch factor stretch and alignment alignment. |
void |
insertWidget(int index,
QWidget widget,
int stretch,
Qt.Alignment alignment)
Inserts widget at position index, with stretch factor stretch and alignment alignment. |
void |
insertWidget(int index,
QWidget widget,
int stretch,
Qt.AlignmentFlag[] alignment)
Inserts widget at position index, with stretch factor stretch and alignment alignment. |
void |
setDirection(QBoxLayout.Direction arg__1)
Sets the direction of this layout to direction. |
void |
setSpacing(int spacing)
Reimplements QLayout.:setSpacing(). |
boolean |
setStretchFactor(QLayout l,
int stretch)
Sets the stretch factor for the layout layout to stretch and returns true if layout is found in this layout (not including child layouts); otherwise returns false. |
boolean |
setStretchFactor(QWidget w,
int stretch)
Sets the stretch factor for widget to stretch and returns true if widget is found in this layout (not including child layouts); otherwise returns false. |
int |
spacing()
Reimplements QLayout.:spacing(). |
Methods inherited from class com.trolltech.qt.gui.QLayout |
---|
activate, addChildLayout, addChildWidget, addItem, addWidget, alignment, alignmentRect, closestAcceptableSize, contentsRect, controlTypes, count, expandingDirections, geometry, getContentsMargins, hasHeightForWidth, heightForWidth, indexOf, invalidate, isEmpty, isEnabled, itemAt, layout, maximumSize, menuBar, minimumHeightForWidth, minimumSize, parentWidget, removeItem, removeWidget, setAlignment, setAlignment, setAlignment, setAlignment, setAlignment, setContentsMargins, setContentsMargins, setEnabled, setGeometry, setMargin, setMenuBar, setSizeConstraint, setWidgetSpacing, sizeConstraint, sizeHint, spacerItem, takeAt, update, widget, widgetSpacing |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QBoxLayout(QBoxLayout.Direction arg__1)
QBoxLayout
with direction dir and parent widget parent. direction()
.
public QBoxLayout(QBoxLayout.Direction arg__1, QWidget parent)
QBoxLayout
with direction dir and parent widget parent. direction()
.
Method Detail |
---|
public final void addLayout(QLayout layout)
insertLayout()
, addItem()
, and addWidget()
.
public final void addLayout(QLayout layout, int stretch)
insertLayout()
, addItem()
, and addWidget()
.
public final void addSpacerItem(QSpacerItem spacerItem)
addSpacing()
, and addStretch()
.
public final void addSpacing(int size)
QSpacerItem
) with size size to the end of this box layout. QBoxLayout
provides default margin and spacing. This function adds additional space. insertSpacing()
, addItem()
, and QSpacerItem
.
public final void addStretch()
QSpacerItem
) with zero minimum size and stretch factor stretch to the end of this box layout. insertStretch()
, addItem()
, and QSpacerItem
.
public final void addStretch(int stretch)
QSpacerItem
) with zero minimum size and stretch factor stretch to the end of this box layout. insertStretch()
, addItem()
, and QSpacerItem
.
public final void addStrut(int arg__1)
LeftToRight
) to a minimum of size. Other constraints may increase the limit. addItem()
.
public final void addWidget(QWidget arg__1, int stretch, Qt.AlignmentFlag[] alignment)
The stretch factor applies only in the direction
of the QBoxLayout
, and is relative to the other boxes and widgets in this QBoxLayout
. Widgets and boxes with higher stretch factors grow more.
If the stretch factor is 0 and nothing else in the QBoxLayout
has a stretch factor greater than zero, the space is distributed according to the QWidget
:sizePolicy() of each widget that's involved.
The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
insertWidget()
, addItem()
, addLayout()
, addStretch()
, addSpacing()
, and addStrut()
.
public final void addWidget(QWidget arg__1, int stretch, Qt.Alignment alignment)
The stretch factor applies only in the direction
of the QBoxLayout
, and is relative to the other boxes and widgets in this QBoxLayout
. Widgets and boxes with higher stretch factors grow more.
If the stretch factor is 0 and nothing else in the QBoxLayout
has a stretch factor greater than zero, the space is distributed according to the QWidget
:sizePolicy() of each widget that's involved.
The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
insertWidget()
, addItem()
, addLayout()
, addStretch()
, addSpacing()
, and addStrut()
.
public final QBoxLayout.Direction direction()
addWidget()
and addSpacing()
work in this direction; the stretch stretches in this direction. setDirection()
, QBoxLayout::Direction
, addWidget()
, and addSpacing()
.
protected final void insertItem(int index, QLayoutItemInterface arg__2)
addItem()
, insertWidget()
, insertLayout()
, insertStretch()
, and insertSpacing()
.
public final void insertLayout(int index, QLayout layout)
layout becomes a child of the box layout.
addLayout()
, and insertItem()
.
public final void insertLayout(int index, QLayout layout, int stretch)
layout becomes a child of the box layout.
addLayout()
, and insertItem()
.
public final void insertSpacerItem(int index, QSpacerItem spacerItem)
addSpacerItem()
, insertStretch()
, and insertSpacing()
.
public final void insertSpacing(int index, int size)
QSpacerItem
) at position index, with size size. If index is negative the space is added at the end. The box layout has default margin and spacing. This function adds additional space.
addSpacing()
, insertItem()
, and QSpacerItem
.
public final void insertStretch(int index)
QSpacerItem
) at position index, with zero minimum size and stretch factor stretch. If index is negative the space is added at the end. addStretch()
, insertItem()
, and QSpacerItem
.
public final void insertStretch(int index, int stretch)
QSpacerItem
) at position index, with zero minimum size and stretch factor stretch. If index is negative the space is added at the end. addStretch()
, insertItem()
, and QSpacerItem
.
public final void insertWidget(int index, QWidget widget, int stretch, Qt.AlignmentFlag[] alignment)
The stretch factor applies only in the direction
of the QBoxLayout
, and is relative to the other boxes and widgets in this QBoxLayout
. Widgets and boxes with higher stretch factors grow more.
If the stretch factor is 0 and nothing else in the QBoxLayout
has a stretch factor greater than zero, the space is distributed according to the QWidget
:sizePolicy() of each widget that's involved.
The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
addWidget()
, and insertItem()
.
public final void insertWidget(int index, QWidget widget, int stretch)
The stretch factor applies only in the direction
of the QBoxLayout
, and is relative to the other boxes and widgets in this QBoxLayout
. Widgets and boxes with higher stretch factors grow more.
If the stretch factor is 0 and nothing else in the QBoxLayout
has a stretch factor greater than zero, the space is distributed according to the QWidget
:sizePolicy() of each widget that's involved.
The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
addWidget()
, and insertItem()
.
public final void insertWidget(int index, QWidget widget)
The stretch factor applies only in the direction
of the QBoxLayout
, and is relative to the other boxes and widgets in this QBoxLayout
. Widgets and boxes with higher stretch factors grow more.
If the stretch factor is 0 and nothing else in the QBoxLayout
has a stretch factor greater than zero, the space is distributed according to the QWidget
:sizePolicy() of each widget that's involved.
The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
addWidget()
, and insertItem()
.
public final void insertWidget(int index, QWidget widget, int stretch, Qt.Alignment alignment)
The stretch factor applies only in the direction
of the QBoxLayout
, and is relative to the other boxes and widgets in this QBoxLayout
. Widgets and boxes with higher stretch factors grow more.
If the stretch factor is 0 and nothing else in the QBoxLayout
has a stretch factor greater than zero, the space is distributed according to the QWidget
:sizePolicy() of each widget that's involved.
The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
addWidget()
, and insertItem()
.
public final void setDirection(QBoxLayout.Direction arg__1)
direction()
.
public final void setSpacing(int spacing)
spacing()
.
public final boolean setStretchFactor(QLayout l, int stretch)
public final boolean setStretchFactor(QWidget w, int stretch)
setAlignment()
.
public final int spacing()
spacing()
. setSpacing()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |