Z DooBLER wiki
Wstęp
Klasa QBoxLayout układa widżety w linii poziomej lub pionowej. Więcej...
| Tekst oryginalny
|
| The QBoxLayout class lines up child widgets horizontally or vertically.
|
#include <QBoxLayout>
Dziedziczy z
QLayout.
Jest dziedziczony przez
QHBoxLayout, QVBoxLayout.
Publiczne typy
- enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop }
Publiczne funkcje
- QBoxLayout ( Direction dir, QWidget * parent = 0 )
- ~QBoxLayout ()
- void addLayout ( QLayout * layout, int stretch = 0 )
- void addSpacerItem ( QSpacerItem * spacerItem )
- void addSpacing ( int size )
- void addStretch ( int stretch = 0 )
- void addStrut ( int size )
- void addWidget ( QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0 )
- Direction direction () const
- void insertLayout ( int index, QLayout * layout, int stretch = 0 )
- void insertSpacerItem ( int index, QSpacerItem * spacerItem )
- void insertSpacing ( int index, int size )
- void insertStretch ( int index, int stretch = 0 )
- void insertWidget ( int index, QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0 )
- virtual void invalidate ()
- void setDirection ( Direction direction )
- void setSpacing ( int spacing )
- bool setStretchFactor ( QWidget * widget, int stretch )
- bool setStretchFactor ( QLayout * layout, int stretch )
- int spacing () const
- 28 publicznych funkcji jest dziedziczonych z QLayout
- 29 publicznych funkcji jest dziedziczonych z QObject
- 17 publicznych funkcji jest dziedziczonych z QLayoutItem
Chronione funkcje
- 3 chronione funkcje są dziedziczone z QLayout
- 7 chronionych funkcji jest dziedziczonych z QObject
Inne dziedziczone
- 2 właściwości są dziedziczone z QLayout
- 1 właściwość jest dziedziczona z QObject
- 1 publiczny slot jest dziedziczony z QObject
- 1 sygnał jest dziedziczony z QObject
- 1 static public member inherited from QLayout
- 5 static public members inherited from QObject
Opis szczegółowy
Klasa QBoxLayout układa widżety w linii poziomej lub pionowej.
| Tekst oryginalny
|
| The QBoxLayout class lines up child widgets horizontally or vertically.
|
QBoxLayout dzieli pozostawione dla niego miejsce (przez szablon nadrzędny lub widżet będący jego rodzicem) na prostokątne obszary (boxy) i wypełnia każdy z nich podległymi mu widzetami.
| Tekst oryginalny
|
| 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.
|
Pięć rozmieszczonych poziomo przycisków.
Jeśli orientacja QBoxLayout jest Qt::Horizontal boxy są położone obok siebie w poziomie, mają również dopasowane rozmiary. Rozmiary każdego widżetu (lub innego boxu) będą dopasowywać się do rozmiarów boxu z zachowaniem jednak symalnej i minimalnej wartości rozmiaru widżetu. Każdy nadmiar miejsca jest rozdzielany zależnie od współczynnika rozciągalności boxu (Więcej na ten temat poniżej).
| Tekst oryginalny
|
| If the 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).
|
Pięć rozmieszczonych pionowo przycisków.
Jeśli orientacja QBoxLayout jest Qt::Vertical boxy są położone jeden pod drugim, także z dopasowanymi rozmiarami.
| Tekst oryginalny
|
| If the QBoxLayout's orientation is Qt::Vertical, the boxes are placed in a column, again with suitable sizes.
|
Najłatwiejszym sposobem na utworzenie szablonu QBoxLayout jest użycie jednej z klas pomocniczych np. QHBoxLayout (dla boxów Qt::Horizontal) lub QVBoxLayout (dla boxów Qt::Vertical). Można także używać bezpośrednio konstruktora QBoxLayout ustawiając jego kierunek jako LeftToRight, RightToLeft, TopToBottom lub BottomToTop.
| Tekst oryginalny
|
| 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.
|
| Tekst oryginalny
|
| 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().
|
| Tekst oryginalny
|
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.
|
| Tekst oryginalny
|
| Use insertWidget(), insertSpacing(), insertStretch() or insertLayout() to insert a box at a specified position in the layout.
|
| Tekst oryginalny
|
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.)
|
| Tekst oryginalny
|
| The margin default is provided by the style. The default margin most Qt styles specify is 9 for child widgets and 11 for windows. The spacing defaults to the same as the margin width for a top-level layout, or to the same as the parent layout.
|
| Tekst oryginalny
|
| 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.
|
| Tekst oryginalny
|
| You will almost always want to use QVBoxLayout and QHBoxLayout rather than QBoxLayout because of their convenient constructors.
|
Zobacz także: QGridLayout, QStackedLayout, Layout.
Opis typów
QBoxLayout::Direction
enum QBoxLayout::Direction
Ten typ służy do definiowania kierunku ułożenia boxów w szablonie.
| Tekst oryginalny
|
| This type is used to determine the direction of a box layout.
|
| Stała
|
Wartość
|
Opis
|
| QBoxLayout::LeftToRight
|
0
|
Poziomo od lewej do prawej.
|
| QBoxLayout::RightToLeft
|
1
|
Poziomo od prawej do lewej.
|
| QBoxLayout::TopToBottom
|
2
|
Pionowo z góry na dół.
|
| QBoxLayout::BottomToTop
|
3
|
Pionowo z dołu do góry.
|
Opis funkcji
QBoxLayout::QBoxLayout
QBoxLayout::QBoxLayout ( Direction dir, QWidget * parent = 0 )
Konstruktor klasy QBoxLayout.
Tworzy nowy obiekt z kierunkiem ułożenia boxów dir i irzyporządkowuje widżet rodzica parent.
Zobacz także direction().
| Tekst oryginalny
|
| Constructs a new QBoxLayout with direction dir and parent widget parent.
|
QBoxLayout::~QBoxLayout ()
Destruktor klasy QBoxLayout.
Niszczy obiekt szablonu.
Widżety, które obejmuje szablon nie są niszczone.
| Tekst oryginalny
|
| Destroys this box layout.
The layout's widgets aren't destroyed.
|
QBoxLayout::addLayout
void QBoxLayout::addLayout ( QLayout * layout, int stretch = 0 )
| Tekst oryginalny
|
| Adds layout to the end of the box, with serial stretch factor stretch.
See also insertLayout(), addItem(), and addWidget().
|
QBoxLayout::addSpacerItem
void QBoxLayout::addSpacerItem ( QSpacerItem * spacerItem )
| Tekst oryginalny
|
| Adds spacerItem to the end of this box layout.
See also addSpacing() and addStretch().
|
QBoxLayout::addSpacing
void QBoxLayout::addSpacing ( int size )
| Tekst oryginalny
|
| Adds a non-stretchable space (a QSpacerItem) with size size to the end of this box layout. QBoxLayout provides default margin and spacing. This function adds additional space.
See also insertSpacing(), addItem(), and QSpacerItem.
|
QBoxLayout::addStretch
void QBoxLayout::addStretch ( int stretch = 0 )
| Tekst oryginalny
|
| Adds a stretchable space (a QSpacerItem) with zero minimum size and stretch factor stretch to the end of this box layout.
See also insertStretch(), addItem(), and QSpacerItem.
|
QBoxLayout::addStrut
void QBoxLayout::addStrut ( int size )
| Tekst oryginalny
|
| Limits the perpendicular dimension of the box (e.g. height if the box is LeftToRight) to a minimum of size. Other constraints may increase the limit.
See also addItem().
|
QBoxLayout::addWidget
void QBoxLayout::addWidget ( QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0 )
| Tekst oryginalny
|
| Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
|
| Tekst oryginalny
|
| 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.
|
| Tekst oryginalny
|
| 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.
|
| Tekst oryginalny
|
| The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
See also insertWidget(), addItem(), addLayout(), addStretch(), addSpacing(), and addStrut().
|
QBoxLayout::direction
Direction QBoxLayout::direction () const
| Tekst oryginalny
|
| Returns the direction of the box. addWidget() and addSpacing() work in this direction; the stretch stretches in this direction.
See also setDirection(), QBoxLayout::Direction, addWidget(), and addSpacing().
|
QBoxLayout::insertItem
void QBoxLayout::insertItem ( int index, QLayoutItem * item ) [protected]
| Tekst oryginalny
|
| Inserts item into this box layout at position index. If index is negative, the item is added at the end.
See also addItem(), insertWidget(), insertLayout(), insertStretch(), and insertSpacing().
|
QBoxLayout::insertLayout
void QBoxLayout::insertLayout ( int index, QLayout * layout, int stretch = 0 )
| Tekst oryginalny
|
| Inserts layout at position index, with stretch factor stretch. If index is negative, the layout is added at the end.
layout becomes a child of the box layout.
See also addLayout() and insertItem().
|
QBoxLayout::insertSpacerItem
void QBoxLayout::insertSpacerItem ( int index, QSpacerItem * spacerItem )
| Tekst oryginalny
|
| Inserts spacerItem at position index, with zero minimum size and stretch factor. If index is negative the space is added at the end.
See also addSpacerItem(), insertStretch(), and insertSpacing().
|
QBoxLayout::insertSpacing
void QBoxLayout::insertSpacing ( int index, int size )
| Tekst oryginalny
|
| Inserts a non-stretchable space (a 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.
See also addSpacing(), insertItem(), and QSpacerItem.
|
QBoxLayout::insertStretch
void QBoxLayout::insertStretch ( int index, int stretch = 0 )
| Tekst oryginalny
|
| Inserts a stretchable space (a QSpacerItem) at position index, with zero minimum size and stretch factor stretch. If index is negative the space is added at the end.
See also addStretch(), insertItem(), and QSpacerItem.
|
QBoxLayout::insertWidget
void QBoxLayout::insertWidget ( int index, QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0 )
| Tekst oryginalny
|
| Inserts widget at position index, with stretch factor stretch and alignment alignment. If index is negative, the widget is added at the end.
|
| Tekst oryginalny
|
| 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.
|
| Tekst oryginalny
|
| 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.
|
| Tekst oryginalny
|
| The alignment is specified by alignment. The default alignment is 0, which means that the widget fills the entire cell.
See also addWidget() and insertItem().
|
QBoxLayout::invalidate
void QBoxLayout::invalidate () [virtual]
| Tekst oryginalny
|
| Resets cached information.
Reimplemented from QLayoutItem.
|
QBoxLayout::setDirection
void QBoxLayout::setDirection ( Direction direction )
| Tekst oryginalny
|
| Sets the direction of this layout to direction.
See also direction().
|
QBoxLayout::setSpacing
void QBoxLayout::setSpacing ( int spacing )
| Tekst oryginalny
|
| Reimplements QLayout::setSpacing(). Sets the spacing property to spacing.
See also QLayout::setSpacing() and spacing().
|
QBoxLayout::setStretchFactor
bool QBoxLayout::setStretchFactor ( QWidget * widget, int stretch )
| Tekst oryginalny
|
| 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.
See also setAlignment().
|
bool QBoxLayout::setStretchFactor ( QLayout * layout, int stretch )
| Tekst oryginalny
|
| This is an overloaded member function, provided for convenience.
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.
|
QBoxLayout::spacing
int QBoxLayout::spacing () const
| Tekst oryginalny
|
| Reimplements QLayout::spacing(). If the spacing property is valid, that value is returned. Otherwise, a value for the spacing property is computed and returned. Since layout spacing in a widget is style dependent, if the parent is a widget, it queries the style for the (horizontal or vertical) spacing of the layout. Otherwise, the parent is a layout, and it queries the parent layout for the spacing().
See also QLayout::spacing() and setSpacing().
|
inne
Tłumaczenie na podstawie oryginalnej dokumentacji ze strony http://doc.trolltech.com
Tekst oryginału http://doc.trolltech.com/4.4/qboxlayout.html
HTTP: HyperText Transfer Protocol