summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/kernel.pri1
-rw-r--r--src/widgets/kernel/qapplication.cpp18
-rw-r--r--src/widgets/kernel/qapplication_p.h2
-rw-r--r--src/widgets/kernel/qgesture.cpp50
-rw-r--r--src/widgets/kernel/qlayout.cpp81
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp19
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp8
-rw-r--r--src/widgets/kernel/qsizepolicy.cpp (renamed from src/widgets/kernel/qsizepolicy.qdoc)140
-rw-r--r--src/widgets/kernel/qsizepolicy.h3
-rw-r--r--src/widgets/kernel/qwidget.cpp10
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp5
11 files changed, 189 insertions, 148 deletions
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index 88c1e2595b..21a982f349 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -49,6 +49,7 @@ SOURCES += \
kernel/qlayoutengine.cpp \
kernel/qlayoutitem.cpp \
kernel/qshortcut.cpp \
+ kernel/qsizepolicy.cpp \
kernel/qstackedlayout.cpp \
kernel/qtooltip.cpp \
kernel/qwhatsthis.cpp \
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 401fb47dc8..f457993168 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -4272,15 +4272,16 @@ void QApplicationPrivate::cleanupMultitouch_sys()
{
}
-QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, const QPointF &screenPos)
+QWidget *QApplicationPrivate::findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint)
{
+ const QPointF screenPos = touchPoint.screenPos();
int closestTouchPointId = -1;
QObject *closestTarget = 0;
qreal closestDistance = qreal(0.);
QHash<ActiveTouchPointsKey, ActiveTouchPointsValue>::const_iterator it = activeTouchPoints.constBegin(),
ite = activeTouchPoints.constEnd();
while (it != ite) {
- if (it.key().device == device) {
+ if (it.key().device == device && it.key().touchPointId != touchPoint.id()) {
const QTouchEvent::TouchPoint &touchPoint = it->touchPoint;
qreal dx = screenPos.x() - touchPoint.screenPos().x();
qreal dy = screenPos.y() - touchPoint.screenPos().y();
@@ -4336,7 +4337,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
}
if (device->type() == QTouchDevice::TouchScreen) {
- QWidget *closestWidget = d->findClosestTouchPointTarget(device, touchPoint.screenPos());
+ QWidget *closestWidget = d->findClosestTouchPointTarget(device, touchPoint);
QWidget *widget = static_cast<QWidget *>(target.data());
if (closestWidget
&& (widget->isAncestorOf(closestWidget) || closestWidget->isAncestorOf(widget))) {
@@ -4356,8 +4357,10 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
#ifdef Q_OS_OSX
// Single-touch events are normally not sent unless WA_TouchPadAcceptSingleTouchEvents is set.
- // In Qt 4 this check was in OS X-only coode. That behavior is preserved here by the #ifdef.
- if (touchPoints.count() == 1 && !targetWidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents))
+ // In Qt 4 this check was in OS X-only code. That behavior is preserved here by the #ifdef.
+ if (touchPoints.count() == 1
+ && device->type() == QTouchDevice::TouchPad
+ && !targetWidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents))
continue;
#endif
@@ -4373,7 +4376,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QHash<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin();
const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd();
for (; it != end; ++it) {
- QWidget *widget = it.key();
+ const QPointer<QWidget> widget = it.key();
if (!QApplicationPrivate::tryModalHelper(widget, 0))
continue;
@@ -4413,7 +4416,8 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
// has been implicitly accepted and continue to send touch events
if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) {
accepted = true;
- widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
+ if (!widget.isNull())
+ widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent);
}
break;
}
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 46359d7940..ba8d7ff63c 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -280,7 +280,7 @@ public:
void initializeMultitouch_sys();
void cleanupMultitouch();
void cleanupMultitouch_sys();
- QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QPointF &screenPos);
+ QWidget *findClosestTouchPointTarget(QTouchDevice *device, const QTouchEvent::TouchPoint &touchPoint);
void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint);
void removeTouchPoint(int touchPointId);
static bool translateRawTouchEvent(QWidget *widget,
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index 713a019cc3..7b7d465070 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -36,7 +36,7 @@
#include "private/qstandardgestures_p.h"
#include "qgraphicsview.h"
-#include <QtCore/QDebug>
+#include <private/qdebug_p.h>
#ifndef QT_NO_GESTURES
QT_BEGIN_NAMESPACE
@@ -1091,9 +1091,12 @@ QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const
static void formatGestureHeader(QDebug d, const char *className, const QGesture *gesture)
{
- d << className << "(state=" << gesture->state();
- if (gesture->hasHotSpot())
- d << ",hotSpot=" << gesture->hotSpot();
+ d << className << "(state=";
+ QtDebugUtils::formatQEnum(d, gesture->state());
+ if (gesture->hasHotSpot()) {
+ d << ",hotSpot=";
+ QtDebugUtils::formatQPoint(d, gesture->hotSpot());
+ }
}
Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGesture *gesture)
@@ -1103,31 +1106,42 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGesture *gesture)
switch (gesture->gestureType()) {
case Qt::TapGesture:
formatGestureHeader(d, "QTapGesture", gesture);
- d << ",position=" << static_cast<const QTapGesture*>(gesture)->position() << ')';
+ d << ",position=";
+ QtDebugUtils::formatQPoint(d, static_cast<const QTapGesture*>(gesture)->position());
+ d << ')';
break;
case Qt::TapAndHoldGesture: {
const QTapAndHoldGesture *tap = static_cast<const QTapAndHoldGesture*>(gesture);
formatGestureHeader(d, "QTapAndHoldGesture", tap);
- d << ",position=" << tap->position() << ",timeout=" << tap->timeout() << ')';
+ d << ",position=";
+ QtDebugUtils::formatQPoint(d, tap->position());
+ d << ",timeout=" << tap->timeout() << ')';
}
break;
case Qt::PanGesture: {
const QPanGesture *pan = static_cast<const QPanGesture*>(gesture);
formatGestureHeader(d, "QPanGesture", pan);
- d << ",lastOffset=" << pan->lastOffset() << ",offset=" << pan->offset()
- << ",acceleration=" << pan->acceleration()
- << ",delta=" << pan->delta() << ')';
+ d << ",lastOffset=";
+ QtDebugUtils::formatQPoint(d, pan->lastOffset());
+ d << pan->lastOffset();
+ d << ",offset=";
+ QtDebugUtils::formatQPoint(d, pan->offset());
+ d << ",acceleration=" << pan->acceleration() << ",delta=";
+ QtDebugUtils::formatQPoint(d, pan->delta());
+ d << ')';
}
break;
case Qt::PinchGesture: {
const QPinchGesture *pinch = static_cast<const QPinchGesture*>(gesture);
formatGestureHeader(d, "QPinchGesture", pinch);
d << ",totalChangeFlags=" << pinch->totalChangeFlags()
- << ",changeFlags=" << pinch->changeFlags()
- << ",startCenterPoint=" << pinch->startCenterPoint()
- << ",lastCenterPoint=" << pinch->lastCenterPoint()
- << ",centerPoint=" << pinch->centerPoint()
- << ",totalScaleFactor=" << pinch->totalScaleFactor()
+ << ",changeFlags=" << pinch->changeFlags() << ",startCenterPoint=";
+ QtDebugUtils::formatQPoint(d, pinch->startCenterPoint());
+ d << ",lastCenterPoint=";
+ QtDebugUtils::formatQPoint(d, pinch->lastCenterPoint());
+ d << ",centerPoint=";
+ QtDebugUtils::formatQPoint(d, pinch->centerPoint());
+ d << ",totalScaleFactor=" << pinch->totalScaleFactor()
<< ",lastScaleFactor=" << pinch->lastScaleFactor()
<< ",scaleFactor=" << pinch->scaleFactor()
<< ",totalRotationAngle=" << pinch->totalRotationAngle()
@@ -1138,9 +1152,11 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QGesture *gesture)
case Qt::SwipeGesture: {
const QSwipeGesture *swipe = static_cast<const QSwipeGesture*>(gesture);
formatGestureHeader(d, "QSwipeGesture", swipe);
- d << ",horizontalDirection=" << swipe->horizontalDirection()
- << ",verticalDirection=" << swipe->verticalDirection()
- << ",swipeAngle=" << swipe->swipeAngle() << ')';
+ d << ",horizontalDirection=";
+ QtDebugUtils::formatQEnum(d, swipe->horizontalDirection());
+ d << ",verticalDirection=";
+ QtDebugUtils::formatQEnum(d, swipe->verticalDirection());
+ d << ",swipeAngle=" << swipe->swipeAngle() << ')';
}
break;
default:
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index dcacea4777..e74f17b6f7 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1470,85 +1470,4 @@ QSize QLayout::closestAcceptableSize(const QWidget *widget, const QSize &size)
return result;
}
-void QSizePolicy::setControlType(ControlType type)
-{
- /*
- The control type is a flag type, with values 0x1, 0x2, 0x4, 0x8, 0x10,
- etc. In memory, we pack it onto the available bits (CTSize) in
- setControlType(), and unpack it here.
-
- Example:
-
- 0x00000001 maps to 0
- 0x00000002 maps to 1
- 0x00000004 maps to 2
- 0x00000008 maps to 3
- etc.
- */
-
- int i = 0;
- while (true) {
- if (type & (0x1 << i)) {
- bits.ctype = i;
- return;
- }
- ++i;
- }
-}
-
-QSizePolicy::ControlType QSizePolicy::controlType() const
-{
- return QSizePolicy::ControlType(1 << bits.ctype);
-}
-
-#ifndef QT_NO_DATASTREAM
-
-/*!
- \relates QSizePolicy
- \since 4.2
-
- Writes the size \a policy to the data stream \a stream.
-
- \sa{Serializing Qt Data Types}{Format of the QDataStream operators}
-*/
-QDataStream &operator<<(QDataStream &stream, const QSizePolicy &policy)
-{
- // The order here is for historical reasons. (compatibility with Qt4)
- quint32 data = (policy.bits.horPolicy | // [0, 3]
- policy.bits.verPolicy << 4 | // [4, 7]
- policy.bits.hfw << 8 | // [8]
- policy.bits.ctype << 9 | // [9, 13]
- policy.bits.wfh << 14 | // [14]
- policy.bits.retainSizeWhenHidden << 15 | // [15]
- policy.bits.verStretch << 16 | // [16, 23]
- policy.bits.horStretch << 24); // [24, 31]
- return stream << data;
-}
-
-#define VALUE_OF_BITS(data, bitstart, bitcount) ((data >> bitstart) & ((1 << bitcount) -1))
-
-/*!
- \relates QSizePolicy
- \since 4.2
-
- Reads the size \a policy from the data stream \a stream.
-
- \sa{Serializing Qt Data Types}{Format of the QDataStream operators}
-*/
-QDataStream &operator>>(QDataStream &stream, QSizePolicy &policy)
-{
- quint32 data;
- stream >> data;
- policy.bits.horPolicy = VALUE_OF_BITS(data, 0, 4);
- policy.bits.verPolicy = VALUE_OF_BITS(data, 4, 4);
- policy.bits.hfw = VALUE_OF_BITS(data, 8, 1);
- policy.bits.ctype = VALUE_OF_BITS(data, 9, 5);
- policy.bits.wfh = VALUE_OF_BITS(data, 14, 1);
- policy.bits.retainSizeWhenHidden = VALUE_OF_BITS(data, 15, 1);
- policy.bits.verStretch = VALUE_OF_BITS(data, 16, 8);
- policy.bits.horStretch = VALUE_OF_BITS(data, 24, 8);
- return stream;
-}
-#endif // QT_NO_DATASTREAM
-
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index b21925e1d4..21f4c9a221 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -34,7 +34,6 @@
#include "qlayout.h"
#include "qapplication.h"
-#include "qdebug.h"
#include "qlayoutengine_p.h"
#include "qmenubar.h"
#include "qtoolbar.h"
@@ -68,14 +67,6 @@ inline static QSize toLayoutItemSize(QWidgetPrivate *priv, const QSize &size)
}
/*!
- Returns a QVariant storing this QSizePolicy.
-*/
-QSizePolicy::operator QVariant() const
-{
- return QVariant(QVariant::SizePolicy, this);
-}
-
-/*!
\class QLayoutItem
\brief The QLayoutItem class provides an abstract item that a
QLayout manipulates.
@@ -847,14 +838,4 @@ int QWidgetItemV2::heightForWidth(int width) const
return height;
}
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QSizePolicy &p)
-{
- QDebugStateSaver saver(dbg);
- dbg.nospace() << "QSizePolicy(horizontalPolicy = " << p.horizontalPolicy()
- << ", verticalPolicy = " << p.verticalPolicy() << ')';
- return dbg;
-}
-#endif
-
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index d4d23604a3..9bfdc62e60 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -104,6 +104,12 @@ QT_BEGIN_NAMESPACE
non-sharable. To overcome this issue, prefer using
QSurfaceFormat::setDefaultFormat() instead of setFormat().
+ \note Calling QSurfaceFormat::setDefaultFormat() before constructing
+ the QApplication instance is mandatory on some platforms (for example,
+ OS X) when an OpenGL core profile context is requested. This is to
+ ensure that resource sharing between contexts stays functional as all
+ internal contexts are created using the correct version and profile.
+
\section1 Painting Techniques
As described above, subclass QOpenGLWidget to render pure 3D content in the
@@ -739,6 +745,7 @@ void QOpenGLWidgetPrivate::initialize()
QScopedPointer<QOpenGLContext> ctx(new QOpenGLContext);
ctx->setShareContext(shareContext);
ctx->setFormat(requestedFormat);
+ ctx->setScreen(shareContext->screen());
if (!ctx->create()) {
qWarning("QOpenGLWidget: Failed to create context");
return;
@@ -762,6 +769,7 @@ void QOpenGLWidgetPrivate::initialize()
// in QQuickWidget, use a dedicated QOffscreenSurface.
surface = new QOffscreenSurface;
surface->setFormat(ctx->format());
+ surface->setScreen(ctx->screen());
surface->create();
if (!ctx->makeCurrent(surface)) {
diff --git a/src/widgets/kernel/qsizepolicy.qdoc b/src/widgets/kernel/qsizepolicy.cpp
index e84412bc46..1476b4c5d7 100644
--- a/src/widgets/kernel/qsizepolicy.qdoc
+++ b/src/widgets/kernel/qsizepolicy.cpp
@@ -3,9 +3,9 @@
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the documentation of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:FDL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
@@ -14,17 +14,31 @@
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
** $QT_END_LICENSE$
**
****************************************************************************/
+#include "qsizepolicy.h"
+
+#include <qdatastream.h>
+#include <qdebug.h>
+#include <qvariant.h>
+
+QT_BEGIN_NAMESPACE
+
/*!
\class QSizePolicy
\brief The QSizePolicy class is a layout attribute describing horizontal
@@ -207,15 +221,18 @@
*/
/*!
- \fn ControlType QSizePolicy::controlType() const
\since 4.3
Returns the control type associated with the widget for which
this size policy applies.
*/
+QSizePolicy::ControlType QSizePolicy::controlType() const
+{
+ return QSizePolicy::ControlType(1 << bits.ctype);
+}
+
/*!
- \fn void QSizePolicy::setControlType(ControlType type)
\since 4.3
Sets the control type associated with the widget for which this
@@ -230,6 +247,31 @@
\sa QStyle::layoutSpacing()
*/
+void QSizePolicy::setControlType(ControlType type)
+{
+ /*
+ The control type is a flag type, with values 0x1, 0x2, 0x4, 0x8, 0x10,
+ etc. In memory, we pack it onto the available bits (CTSize) in
+ setControlType(), and unpack it here.
+
+ Example:
+
+ 0x00000001 maps to 0
+ 0x00000002 maps to 1
+ 0x00000004 maps to 2
+ 0x00000008 maps to 3
+ etc.
+ */
+
+ int i = 0;
+ while (true) {
+ if (type & (0x1 << i)) {
+ bits.ctype = i;
+ return;
+ }
+ ++i;
+ }
+}
/*!
\fn void QSizePolicy::setHeightForWidth(bool dependent)
@@ -344,7 +386,8 @@
\fn void QSizePolicy::retainSizeWhenHidden() const
\since 5.2
- Returns if the layout should retain the widgets size when it is hidden. This is by default false.
+ Returns whether the layout should retain the widget's size when it is hidden.
+ This is \c false by default.
\sa setRetainSizeWhenHidden()
*/
@@ -353,8 +396,8 @@
\fn void QSizePolicy::setRetainSizeWhenHidden(bool retainSize)
\since 5.2
- Set if a layout should retain the widgets size when it is hidden.
- If \a retainSize is true the layout will not be changed by hiding the widget.
+ Sets whether a layout should retain the widget's size when it is hidden.
+ If \a retainSize is \c true, the layout will not be changed by hiding the widget.
\sa retainSizeWhenHidden()
*/
@@ -385,3 +428,72 @@
\sa setControlType(), controlType()
*/
+/*!
+ Returns a QVariant storing this QSizePolicy.
+*/
+QSizePolicy::operator QVariant() const
+{
+ return QVariant(QVariant::SizePolicy, this);
+}
+
+#ifndef QT_NO_DATASTREAM
+
+/*!
+ \relates QSizePolicy
+ \since 4.2
+
+ Writes the size \a policy to the data stream \a stream.
+
+ \sa{Serializing Qt Data Types}{Format of the QDataStream operators}
+*/
+QDataStream &operator<<(QDataStream &stream, const QSizePolicy &policy)
+{
+ // The order here is for historical reasons. (compatibility with Qt4)
+ quint32 data = (policy.bits.horPolicy | // [0, 3]
+ policy.bits.verPolicy << 4 | // [4, 7]
+ policy.bits.hfw << 8 | // [8]
+ policy.bits.ctype << 9 | // [9, 13]
+ policy.bits.wfh << 14 | // [14]
+ policy.bits.retainSizeWhenHidden << 15 | // [15]
+ policy.bits.verStretch << 16 | // [16, 23]
+ policy.bits.horStretch << 24); // [24, 31]
+ return stream << data;
+}
+
+#define VALUE_OF_BITS(data, bitstart, bitcount) ((data >> bitstart) & ((1 << bitcount) -1))
+
+/*!
+ \relates QSizePolicy
+ \since 4.2
+
+ Reads the size \a policy from the data stream \a stream.
+
+ \sa{Serializing Qt Data Types}{Format of the QDataStream operators}
+*/
+QDataStream &operator>>(QDataStream &stream, QSizePolicy &policy)
+{
+ quint32 data;
+ stream >> data;
+ policy.bits.horPolicy = VALUE_OF_BITS(data, 0, 4);
+ policy.bits.verPolicy = VALUE_OF_BITS(data, 4, 4);
+ policy.bits.hfw = VALUE_OF_BITS(data, 8, 1);
+ policy.bits.ctype = VALUE_OF_BITS(data, 9, 5);
+ policy.bits.wfh = VALUE_OF_BITS(data, 14, 1);
+ policy.bits.retainSizeWhenHidden = VALUE_OF_BITS(data, 15, 1);
+ policy.bits.verStretch = VALUE_OF_BITS(data, 16, 8);
+ policy.bits.horStretch = VALUE_OF_BITS(data, 24, 8);
+ return stream;
+}
+#endif // QT_NO_DATASTREAM
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QSizePolicy &p)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "QSizePolicy(horizontalPolicy = " << p.horizontalPolicy()
+ << ", verticalPolicy = " << p.verticalPolicy() << ')';
+ return dbg;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 2376a2c644..6cd511f513 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -112,7 +112,7 @@ public:
bool operator==(const QSizePolicy& s) const { return data == s.data; }
bool operator!=(const QSizePolicy& s) const { return data != s.data; }
- operator QVariant() const; // implemented in qlayoutitem.cpp
+ operator QVariant() const;
int horizontalStretch() const { return static_cast<int>(bits.horStretch); }
int verticalStretch() const { return static_cast<int>(bits.verStretch); }
@@ -155,7 +155,6 @@ Q_DECLARE_TYPEINFO(QSizePolicy, Q_PRIMITIVE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
#ifndef QT_NO_DATASTREAM
-// implemented in qlayout.cpp
Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
#endif
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index b49fd9b3b6..b4943bbe05 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -4859,7 +4859,7 @@ void QWidget::unsetLayoutDirection()
\fn QFontMetrics QWidget::fontMetrics() const
Returns the font metrics for the widget's current font.
- Equivalent to QFontMetrics(widget->font()).
+ Equivalent to \c QFontMetrics(widget->font()).
\sa font(), fontInfo(), setFont()
*/
@@ -4868,7 +4868,7 @@ void QWidget::unsetLayoutDirection()
\fn QFontInfo QWidget::fontInfo() const
Returns the font info for the widget's current font.
- Equivalent to QFontInto(widget->font()).
+ Equivalent to \c QFontInfo(widget->font()).
\sa font(), fontMetrics(), setFont()
*/
@@ -7334,6 +7334,8 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
stream >> restoredScreenWidth;
const QDesktopWidget * const desktop = QApplication::desktop();
+ if (restoredScreenNumber >= desktop->numScreens())
+ restoredScreenNumber = desktop->primaryScreen();
const qreal screenWidthF = qreal(desktop->screenGeometry(restoredScreenNumber).width());
// Sanity check bailing out when large variations of screen sizes occur due to
// high DPI scaling or different levels of DPI awareness.
@@ -7361,9 +7363,6 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
.expandedTo(d_func()->adjustedSize()));
}
- if (restoredScreenNumber >= desktop->numScreens())
- restoredScreenNumber = desktop->primaryScreen();
-
const QRect availableGeometry = desktop->availableGeometry(restoredScreenNumber);
// Modify the restored geometry if we are about to restore to coordinates
@@ -12093,6 +12092,7 @@ QOpenGLContext *QWidgetPrivate::shareContext() const
QOpenGLContext *ctx = new QOpenGLContext;
ctx->setShareContext(qt_gl_global_share_context());
ctx->setFormat(extra->topextra->window->format());
+ ctx->setScreen(extra->topextra->window->screen());
ctx->create();
that->extra->topextra->shareContext = ctx;
}
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 485cf82078..d1070839fa 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -962,7 +962,8 @@ static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatfo
QPlatformTextureList::Flags flags = 0;
if (widget->testAttribute(Qt::WA_AlwaysStackOnTop))
flags |= QPlatformTextureList::StacksOnTop;
- widgetTextures->appendTexture(widget, wd->textureId(), QRect(widget->mapTo(tlw, QPoint()), widget->size()), flags);
+ const QRect rect(widget->mapTo(tlw, QPoint()), widget->size());
+ widgetTextures->appendTexture(widget, wd->textureId(), rect, wd->clipRect(), flags);
}
for (int i = 0; i < wd->children.size(); ++i) {
@@ -1156,7 +1157,7 @@ void QWidgetBackingStore::doSync()
#ifndef QT_NO_OPENGL
if (widgetTextures && widgetTextures->count()) {
for (int i = 0; i < widgetTextures->count(); ++i) {
- QWidget *w = widgetTextures->widget(i);
+ QWidget *w = static_cast<QWidget *>(widgetTextures->source(i));
if (dirtyRenderToTextureWidgets.contains(w)) {
const QRect rect = widgetTextures->geometry(i); // mapped to the tlw already
dirty += rect;