124 qSwap(leftBox, rightBox);
141 qSwap(leftDelta, rightDelta);
143 l =
qMax(l, leftDelta);
169 qSwap(topBox, bottomBox);
179 if (
bottom && bottomBox) {
240 QSizePolicy::ControlTypes controlTypes1;
241 QSizePolicy::ControlTypes controlTypes2;
242 int fixedSpacing =
q->spacing();
243 int previousNonEmptyIndex = -1;
246 if (fixedSpacing < 0) {
248 style = parentWidget->style();
251 for (
int i = 0;
i <
n;
i++) {
253 QSize max =
box->item->maximumSize();
254 QSize min =
box->item->minimumSize();
256 Qt::Orientations exp =
box->item->expandingDirections();
257 bool empty =
box->item->isEmpty();
261 if (fixedSpacing >= 0) {
262 spacing = (previousNonEmptyIndex >= 0) ? fixedSpacing : 0;
264 if (!
horz(
dir) && previousNonEmptyIndex >= 0) {
274 controlTypes1 = controlTypes2;
275 controlTypes2 =
box->item->controlTypes();
276 if (previousNonEmptyIndex >= 0) {
277 QSizePolicy::ControlTypes actual1 = controlTypes1;
278 QSizePolicy::ControlTypes actual2 = controlTypes2;
280 qSwap(actual1, actual2);
285 nullptr,
q->parentWidget());
292 if (previousNonEmptyIndex >= 0)
293 a[previousNonEmptyIndex].spacing =
spacing;
294 previousNonEmptyIndex =
i;
297 bool ignore = empty &&
box->item->widget();
301 horexp = horexp || expand;
308 minh =
qMax(minh, min.height());
311 a[
i].sizeHint =
hint.width();
312 a[
i].maximumSize = max.
width();
313 a[
i].minimumSize = min.width();
314 a[
i].expansive = expand;
315 a[
i].stretch =
box->stretch ?
box->stretch :
box->hStretch();
318 verexp = verexp || expand;
320 minh +=
spacing + min.height();
325 minw =
qMax(minw, min.width());
328 a[
i].sizeHint =
hint.height();
330 a[
i].minimumSize = min.height();
331 a[
i].expansive = expand;
332 a[
i].stretch =
box->stretch ?
box->stretch :
box->vStretch();
376 for (
int i = 0;
i <
n;
i++) {
382 for (
int i = 0;
i <
n; ++
i) {
563 if (
d->spacing >=0) {
592 const_cast<QBoxLayout*
>(
this)->d_func()->setupGeom();
603 const_cast<QBoxLayout*
>(
this)->d_func()->setupGeom();
614 const_cast<QBoxLayout*
>(
this)->d_func()->setupGeom();
632 const_cast<QBoxLayout*
>(
this)->d_func()->setupGeom();
649 if (
w !=
d->hfwWidth)
650 const_cast<QBoxLayout*
>(
this)->d_func()->calcHfw(
w);
663 d->effectiveMargins(
nullptr, &
top,
nullptr, &
bottom);
664 return d->hasHfw ? (
d->hfwMinHeight +
top +
bottom) : -1;
683 return d->list.size();
701 if (index < 0 || index >=
d->list.size())
710 if (l->parent() ==
this)
711 l->setParent(
nullptr);
726 const_cast<QBoxLayout*
>(
this)->d_func()->setupGeom();
751 int space =
horz(
d->dir) ?
s.width() :
s.height();
753 if (
d->hasHfw && !
horz(
d->dir)) {
754 for (
int i = 0;
i <
n;
i++) {
756 if (
box->item->hasHeightForWidth()) {
757 int width =
qBound(
box->item->minimumSize().width(),
s.width(),
box->item->maximumSize().width());
758 a[
i].sizeHint =
a[
i].minimumSize =
775 bool reverse = (
horz(visualDir)
777 :
r.bottom() > oldRect.
bottom());
778 for (
int j = 0;
j <
n;
j++) {
779 int i = reverse ?
n-
j-1 :
j;
784 box->item->setGeometry(
QRect(
a.at(
i).pos,
s.y(),
a.at(
i).size,
s.height()));
787 box->item->setGeometry(
QRect(
s.left() +
s.right() -
a.at(
i).pos -
a.at(
i).size + 1,
788 s.y(),
a.at(
i).size,
s.height()));
791 box->item->setGeometry(
QRect(
s.x(),
a.at(
i).pos,
s.width(),
a.at(
i).size));
795 s.top() +
s.bottom() -
a.at(
i).pos -
a.at(
i).size + 1,
796 s.width(),
a.at(
i).size));
1058 for (
int i = 0;
i <
d->list.size(); ++
i) {
1079 for (
int i = 0;
i <
d->list.size(); ++
i) {
1120 return d->list.at(
index)->stretch;
1137 for (
int i = 0;
i <
d->list.size(); ++
i) {
1142 if (
sp->expandingDirections() == Qt::Orientations{} ) {
1145 sp->changeSize(
s.height(),
s.width(),
1326#include "moc_qboxlayout.cpp"
QBoxLayout::Direction dir
QLayoutItem * replaceAt(int index, QLayoutItem *) override
void effectiveMargins(int *left, int *top, int *right, int *bottom) const
QList< QLayoutStruct > geomArray
int validateIndex(int index) const
QList< QBoxLayoutItem * > list
Qt::Orientations expanding
The QBoxLayout class lines up child widgets horizontally or vertically.
void setGeometry(const QRect &) override
\reimp
void invalidate() override
Resets cached information.
QSize minimumSize() const override
\reimp
int count() const override
\reimp
void insertStretch(int index, int stretch=0)
Inserts a stretchable space (a QSpacerItem) at position index, with zero minimum size and stretch fac...
void insertSpacing(int index, int size)
Inserts a non-stretchable space (a QSpacerItem) at position index, with size size.
int spacing() const override
Reimplements QLayout::spacing().
void insertLayout(int index, QLayout *layout, int stretch=0)
Inserts layout at position index, with stretch factor stretch.
QSize sizeHint() const override
\reimp
void addSpacerItem(QSpacerItem *spacerItem)
QSize maximumSize() const override
\reimp
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
QLayoutItem * takeAt(int) override
\reimp
int heightForWidth(int) const override
\reimp
void addStrut(int)
Limits the perpendicular dimension of the box (e.g.
Direction
This type is used to determine the direction of a box layout.
int minimumHeightForWidth(int) const override
\reimp
bool setStretchFactor(QWidget *w, int stretch)
Sets the stretch factor for widget to stretch and returns true if widget is found in this layout (not...
Direction direction() const
Returns the direction of the box.
void addItem(QLayoutItem *) override
\reimp
void addSpacing(int size)
Adds a non-stretchable space (a QSpacerItem) with size size to the end of this box layout.
void insertItem(int index, QLayoutItem *)
Inserts item into this box layout at position index.
bool hasHeightForWidth() const override
\reimp
~QBoxLayout()
Destroys this box layout.
void addStretch(int stretch=0)
Adds a stretchable space (a QSpacerItem) with zero minimum size and stretch factor stretch to the end...
void insertSpacerItem(int index, QSpacerItem *spacerItem)
void setStretch(int index, int stretch)
Sets the stretch factor at position index.
Qt::Orientations expandingDirections() const override
\reimp
QLayoutItem * itemAt(int) const override
\reimp
QBoxLayout(Direction, QWidget *parent=nullptr)
Constructs a new QBoxLayout with direction dir and parent widget parent.
void insertWidget(int index, QWidget *widget, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Inserts widget at position index, with stretch factor stretch and alignment alignment.
void setDirection(Direction)
Sets the direction of this layout to direction.
void setSpacing(int spacing) override
Reimplements QLayout::setSpacing().
int stretch(int index) const
Returns the stretch factor at position index.
void addLayout(QLayout *layout, int stretch=0)
Adds layout to the end of the box, with serial stretch factor stretch.
Qt::LayoutDirection layoutDirection
the default layout direction for this application
~QHBoxLayout()
Destroys this box layout.
QHBoxLayout()
Constructs a new horizontal box.
The QLayoutItem class provides an abstract item that a QLayout manipulates.
virtual QSize minimumSize() const =0
Implemented in subclasses to return the minimum size of this item.
virtual QRect geometry() const =0
Returns the rectangle covered by this layout item.
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false.
virtual int heightForWidth(int) const
Returns the preferred height for this layout item, given the width, which is not used in this default...
Qt::Alignment alignment() const
Returns the alignment of this item.
virtual QSpacerItem * spacerItem()
If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise \nullptr is returned.
virtual int minimumHeightForWidth(int) const
Returns the minimum height this widget needs for the given width, w.
virtual QWidget * widget() const
If this item manages a QWidget, returns that widget.
virtual QSize sizeHint() const =0
Implemented in subclasses to return the preferred size of this item.
static QWidgetItem * createWidgetItem(const QLayout *layout, QWidget *widget)
static QSpacerItem * createSpacerItem(const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy=QSizePolicy::Minimum, QSizePolicy::Policy vPolicy=QSizePolicy::Minimum)
The QLayout class is the base class of geometry managers.
QRect geometry() const override
\reimp
void addChildWidget(QWidget *w)
This function is called from addWidget() functions in subclasses to add w as a managed widget of a la...
QRect alignmentRect(const QRect &) const
Returns the rectangle that should be covered when the geometry of this layout is set to r,...
void invalidate() override
\reimp
QWidget * parentWidget() const
Returns the parent widget of this layout, or \nullptr if this layout is not installed on any widget.
bool adoptLayout(QLayout *layout)
virtual void setGeometry(const QRect &) override
\reimp
QLayout * layout() override
\reimp
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
T value(qsizetype i) const
qsizetype count() const noexcept
QObject * parent() const
Returns a pointer to the parent object.
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
constexpr int horizontalStretch() const noexcept
Returns the horizontal stretch factor of the size policy.
constexpr int verticalStretch() const noexcept
Returns the vertical stretch factor of the size policy.
constexpr QSize boundedTo(const QSize &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr QSize expandedTo(const QSize &) const noexcept
Returns a size holding the maximum width and height of this size and the given otherSize.
The QSpacerItem class provides blank space in a layout.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option=nullptr, QWidget *widget=nullptr) const
@ PM_LayoutVerticalSpacing
@ PM_LayoutHorizontalSpacing
QVBoxLayout()
Constructs a new vertical box.
~QVBoxLayout()
Destroys this box layout.
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static bool horz(QBoxLayout::Direction dir)
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
Q_WIDGETS_EXPORT int qSmartSpacing(const QLayout *layout, QStyle::PixelMetric pm)
void qGeomCalc(QList< QLayoutStruct > &chain, int start, int count, int pos, int space, int spacer)
static void qMaxExpCalc(int &max, bool &exp, bool &empty, int boxmax, bool boxexp, bool boxempty)
QT_BEGIN_NAMESPACE constexpr int QLAYOUTSIZE_MAX
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
GLsizei const GLint * box
GLfloat GLfloat GLfloat GLfloat h
GLdouble GLdouble GLdouble GLdouble q
#define Q_ASSERT_X(cond, x, msg)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
QBoxLayoutItem(QLayoutItem *it, int stretch_=0)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent