summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r--src/gui/kernel/qwidget.cpp27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 702652580..8b8a85341 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -505,7 +505,7 @@ void QWidget::setAutoFillBackground(bool enabled)
been outlined to indicate their full sizes.
If you want to use a QWidget to hold child widgets you will usually want to
- add a layout to the parent QWidget. See \l{Layout Classes} for more
+ add a layout to the parent QWidget. See \l{Layout Management} for more
information.
@@ -3491,11 +3491,16 @@ bool QWidgetPrivate::setMinimumSize_helper(int &minw, int &minh)
minh = qMax(minh, 0);
}
createExtra();
- if (extra->minw == minw && extra->minh == minh)
+ int mw = minw, mh = minh;
+ if (mw == QWIDGETSIZE_MAX)
+ mw = 0;
+ if (mh == QWIDGETSIZE_MAX)
+ mh = 0;
+ if (extra->minw == mw && extra->minh == mh)
return false;
- extra->minw = minw;
- extra->minh = minh;
- extra->explicitMinSize = (minw ? Qt::Horizontal : 0) | (minh ? Qt::Vertical : 0);
+ extra->minw = mw;
+ extra->minh = mh;
+ extra->explicitMinSize = (mw ? Qt::Horizontal : 0) | (mh ? Qt::Vertical : 0);
return true;
}
@@ -3555,7 +3560,8 @@ bool QWidgetPrivate::setMaximumSize_helper(int &maxw, int &maxh)
return false;
extra->maxw = maxw;
extra->maxh = maxh;
- extra->explicitMaxSize = (maxw != QWIDGETSIZE_MAX ? Qt::Horizontal : 0) | (maxh != QWIDGETSIZE_MAX ? Qt::Vertical : 0);
+ extra->explicitMaxSize = (maxw != QWIDGETSIZE_MAX ? Qt::Horizontal : 0) |
+ (maxh != QWIDGETSIZE_MAX ? Qt::Vertical : 0);
return true;
}
@@ -3634,6 +3640,8 @@ void QWidget::setBaseSize(int basew, int baseh)
This will override the default size constraints set by QLayout.
+ To remove constraints, set the size to QWIDGETSIZE_MAX.
+
Alternatively, if you want the widget to have a
fixed size based on its contents, you can call
QLayout::setSizeConstraint(QLayout::SetFixedSize);
@@ -3675,7 +3683,8 @@ void QWidget::setFixedSize(int w, int h)
else
d->updateGeometry_helper(true);
- resize(w, h);
+ if (w != QWIDGETSIZE_MAX || h != QWIDGETSIZE_MAX)
+ resize(w, h);
}
void QWidget::setMinimumWidth(int w)
@@ -8854,7 +8863,7 @@ QRegion QWidget::mask() const
The layout manager sets the geometry of the widget's children
that have been added to the layout.
- \sa setLayout(), sizePolicy(), {Layout Classes}
+ \sa setLayout(), sizePolicy(), {Layout Management}
*/
QLayout *QWidget::layout() const
{
@@ -8884,7 +8893,7 @@ QLayout *QWidget::layout() const
The QWidget will take ownership of \a layout.
- \sa layout(), {Layout Classes}
+ \sa layout(), {Layout Management}
*/
void QWidget::setLayout(QLayout *l)