summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qlayoutitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qlayoutitem.cpp')
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 31276d015d..6524d8f2b8 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -150,7 +150,7 @@ QSizePolicy::operator QVariant() const
\brief The QWidgetItem class is a layout item that represents a widget.
\inmodule QtWidgets
-
+
Normally, you don't need to use this class directly. Qt's
built-in layout managers provide the following functions for
manipulating widgets in layouts:
@@ -446,20 +446,20 @@ void QWidgetItem::setGeometry(const QRect &rect)
QRect r = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect)
? fromLayoutItemRect(wid->d_func(), rect)
: rect;
- const QSize widgetRectSurplus = r.size() - rect.size();
-
- /*
- For historical reasons, this code is done using widget rect
- coordinates, not layout item rect coordinates. However,
- QWidgetItem's sizeHint(), maximumSize(), and heightForWidth()
- all work in terms of layout item rect coordinates, so we have to
- add or subtract widgetRectSurplus here and there. The code could
- be much simpler if we did everything using layout item rect
- coordinates and did the conversion right before the call to
- QWidget::setGeometry().
- */
-
- QSize s = r.size().boundedTo(maximumSize() + widgetRectSurplus);
+ const QSize widgetRectSurplus = r.size() - rect.size();
+
+ /*
+ For historical reasons, this code is done using widget rect
+ coordinates, not layout item rect coordinates. However,
+ QWidgetItem's sizeHint(), maximumSize(), and heightForWidth()
+ all work in terms of layout item rect coordinates, so we have to
+ add or subtract widgetRectSurplus here and there. The code could
+ be much simpler if we did everything using layout item rect
+ coordinates and did the conversion right before the call to
+ QWidget::setGeometry().
+ */
+
+ QSize s = r.size().boundedTo(maximumSize() + widgetRectSurplus);
int x = r.x();
int y = r.y();
if (align & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)) {
@@ -474,8 +474,8 @@ void QWidgetItem::setGeometry(const QRect &rect)
s.setWidth(qMin(s.width(), pref.width()));
if (align & Qt::AlignVertical_Mask) {
if (hasHeightForWidth())
- s.setHeight(qMin(s.height(),
- heightForWidth(s.width() - widgetRectSurplus.width())
+ s.setHeight(qMin(s.height(),
+ heightForWidth(s.width() - widgetRectSurplus.width())
+ widgetRectSurplus.height()));
else
s.setHeight(qMin(s.height(), pref.height()));