summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp49
-rw-r--r--src/widgets/kernel/qapplication_p.h6
-rw-r--r--src/widgets/kernel/qdesktopwidget_p.h1
-rw-r--r--src/widgets/kernel/qformlayout.cpp6
-rw-r--r--src/widgets/kernel/qgesture.cpp2
-rw-r--r--src/widgets/kernel/qgesture.h3
-rw-r--r--src/widgets/kernel/qsizepolicy.cpp12
-rw-r--r--src/widgets/kernel/qsizepolicy.h78
-rw-r--r--src/widgets/kernel/qwidget.cpp56
-rw-r--r--src/widgets/kernel/qwidget.h1
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp4
-rw-r--r--src/widgets/kernel/qwidgetwindow_p.h1
12 files changed, 132 insertions, 87 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 5908d3036b..008b2a0d77 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -408,7 +408,6 @@ QWidget *QApplicationPrivate::focus_widget = 0; // has keyboard input foc
QWidget *QApplicationPrivate::hidden_focus_widget = 0; // will get keyboard input focus after show()
QWidget *QApplicationPrivate::active_window = 0; // toplevel with keyboard focus
#ifndef QT_NO_WHEELEVENT
-int QApplicationPrivate::wheel_scroll_lines; // number of lines to scroll
QPointer<QWidget> QApplicationPrivate::wheel_widget;
#endif
bool qt_in_tab_key_event = false;
@@ -642,19 +641,12 @@ void QApplicationPrivate::initialize()
if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0)
QCoreApplication::setAttribute(Qt::AA_NativeWindows);
-#ifndef QT_NO_WHEELEVENT
- QApplicationPrivate::wheel_scroll_lines = 3;
-#endif
-
if (qt_is_gui_used)
initializeMultitouch();
if (QApplication::desktopSettingsAware())
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt();
-#ifndef QT_NO_WHEELEVENT
- QApplicationPrivate::wheel_scroll_lines = theme->themeHint(QPlatformTheme::WheelScrollLines).toInt();
-#endif
}
is_app_running = true; // no longer starting up
@@ -2455,26 +2447,11 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
for (int i = 0; i < modalWindowList.count(); ++i) {
QWindow *modalWindow = modalWindowList.at(i);
- {
- // check if the modal window is our window or a (transient) parent of our window
- QWindow *w = window;
- while (w) {
- if (w == modalWindow) {
- *blockingWindow = 0;
- return false;
- }
- QWindow *p = w->parent();
- if (!p)
- p = w->transientParent();
- w = p;
- }
-
- // Embedded in-process windows are not visible in normal parent-child chain,
- // so check the native parent chain, too.
- const QPlatformWindow *platWin = window->handle();
- const QPlatformWindow *modalPlatWin = modalWindow->handle();
- if (platWin && modalPlatWin && platWin->isEmbedded(modalPlatWin))
- return false;
+ // A window is not blocked by another modal window if the two are
+ // the same, or if the window is a child of the modal window.
+ if (window == modalWindow || modalWindow->isAncestorOf(window, QWindow::IncludeTransients)) {
+ *blockingWindow = 0;
+ return false;
}
Qt::WindowModality windowModality = modalWindow->modality();
@@ -3558,9 +3535,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
touchEvent->setTarget(widget);
for (int i = 0; i < touchEvent->_touchPoints.size(); ++i) {
QTouchEvent::TouchPoint &pt = touchEvent->_touchPoints[i];
- QRectF rect = pt.rect();
- rect.translate(offset);
- pt.d->rect = rect;
+ pt.d->pos = pt.pos() + offset;
pt.d->startPos = pt.startPos() + offset;
pt.d->lastPos = pt.lastPos() + offset;
}
@@ -4066,16 +4041,18 @@ int QApplication::keyboardInputInterval()
or \l{QAbstractItemView::ScrollPerPixel}{scroll one pixel}.
By default, this property has a value of 3.
+
+ \sa QStyleHints::wheelScrollLines()
*/
#ifndef QT_NO_WHEELEVENT
int QApplication::wheelScrollLines()
{
- return QApplicationPrivate::wheel_scroll_lines;
+ return styleHints()->wheelScrollLines();
}
void QApplication::setWheelScrollLines(int lines)
{
- QApplicationPrivate::wheel_scroll_lines = lines;
+ styleHints()->setWheelScrollLines(lines);
}
#endif
@@ -4257,12 +4234,10 @@ bool QApplicationPrivate::updateTouchPointsForWidget(QWidget *widget, QTouchEven
QTouchEvent::TouchPoint &touchPoint = touchEvent->_touchPoints[i];
// preserve the sub-pixel resolution
- QRectF rect = touchPoint.screenRect();
- const QPointF screenPos = rect.center();
+ const QPointF screenPos = touchPoint.screenRect().center();
const QPointF delta = screenPos - screenPos.toPoint();
- rect.moveCenter(widget->mapFromGlobal(screenPos.toPoint()) + delta);
- touchPoint.d->rect = rect;
+ touchPoint.d->pos = widget->mapFromGlobal(screenPos.toPoint()) + delta;
touchPoint.d->startPos = widget->mapFromGlobal(touchPoint.startScreenPos().toPoint()) + delta;
touchPoint.d->lastPos = widget->mapFromGlobal(touchPoint.lastScreenPos().toPoint()) + delta;
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 73c75bbc14..271844a23e 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -91,12 +91,6 @@ extern Q_GUI_EXPORT bool qt_is_gui_used;
extern QClipboard *qt_clipboard;
#endif
-#if defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN)
-extern QSysInfo::WinVersion qt_winver;
-#elif defined (Q_OS_MAC)
-extern QSysInfo::MacVersion qt_macver;
-#endif
-
typedef QHash<QByteArray, QFont> FontHash;
FontHash *qt_app_fonts_hash();
diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h
index 4846a868aa..dade4fe45e 100644
--- a/src/widgets/kernel/qdesktopwidget_p.h
+++ b/src/widgets/kernel/qdesktopwidget_p.h
@@ -56,6 +56,7 @@
#include "private/qwidget_p.h"
#include <QtCore/qalgorithms.h>
+#include <QtGui/qscreen.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index f3f7280030..a06d01be67 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -1167,12 +1167,12 @@ QLayoutItem* QFormLayoutPrivate::replaceAt(int index, QLayoutItem *newitem)
*/
/*!
- \since 5.8
- \struct QFormLayout::TakeRowResult
+ \class QFormLayout::TakeRowResult
\brief Contains the result of a QFormLayout::takeRow() call.
-
+ \inmodule QtWidgets
+ \since 5.8
\sa QFormLayout::takeRow()
*/
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index 2f33066389..3962cbe6c5 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -819,7 +819,6 @@ void QTapAndHoldGesture::setPosition(const QPointF &value)
later the touch is still down, it will trigger the QTapAndHoldGesture.
The default value is 700 milliseconds.
*/
-// static
void QTapAndHoldGesture::setTimeout(int msecs)
{
QTapAndHoldGesturePrivate::Timeout = msecs;
@@ -832,7 +831,6 @@ void QTapAndHoldGesture::setTimeout(int msecs)
later the touch is still down, it will trigger the QTapAndHoldGesture.
The default value is 700 milliseconds.
*/
-// static
int QTapAndHoldGesture::timeout()
{
return QTapAndHoldGesturePrivate::Timeout;
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 034d1d88c1..4dd6e82fd1 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -135,7 +135,6 @@ class Q_WIDGETS_EXPORT QPinchGesture : public QGesture
{
Q_OBJECT
Q_DECLARE_PRIVATE(QPinchGesture)
- Q_FLAGS(ChangeFlags ChangeFlag)
public:
enum ChangeFlag {
@@ -143,7 +142,9 @@ public:
RotationAngleChanged = 0x2,
CenterPointChanged = 0x4
};
+ Q_FLAG(ChangeFlag)
Q_DECLARE_FLAGS(ChangeFlags, ChangeFlag)
+ Q_FLAG(ChangeFlags)
Q_PROPERTY(ChangeFlags totalChangeFlags READ totalChangeFlags WRITE setTotalChangeFlags)
Q_PROPERTY(ChangeFlags changeFlags READ changeFlags WRITE setChangeFlags)
diff --git a/src/widgets/kernel/qsizepolicy.cpp b/src/widgets/kernel/qsizepolicy.cpp
index e902bb522c..34ad64217b 100644
--- a/src/widgets/kernel/qsizepolicy.cpp
+++ b/src/widgets/kernel/qsizepolicy.cpp
@@ -395,6 +395,18 @@ void QSizePolicy::setControlType(ControlType type)
\fn void QSizePolicy::transpose()
Swaps the horizontal and vertical policies and stretches.
+
+ \sa transposed()
+*/
+
+/*!
+ \fn QSizePolicy QSizePolicy::transposed()
+ \since 5.9
+
+ Returns a size policy object with the horizontal and vertical
+ policies and stretches swapped.
+
+ \sa transpose()
*/
/*!
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 63b578fbf3..80bc8eacdb 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -45,6 +45,29 @@
QT_BEGIN_NAMESPACE
+// gcc < 4.8.0 has problems with init'ing variant members in constexpr ctors
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54922
+#if !defined(Q_CC_GNU) || defined(Q_CC_INTEL) || defined(Q_CC_CLANG) || Q_CC_GNU >= 408
+# define QT_SIZEPOLICY_CONSTEXPR Q_DECL_CONSTEXPR
+# if defined(Q_COMPILER_UNIFORM_INIT)
+# define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT Q_DECL_CONSTEXPR
+# if defined(Q_COMPILER_CONSTEXPR)
+# define QT_SIZEPOLICY_RETURN_BITS(E1, E2, E3, E4, E5, E6, E7, E8) \
+ return Bits{ E1, E2, E3, E4, E5, E6, E7, E8 }
+# endif // constexpr && uniform-init
+# endif // uniform-init
+#endif
+
+#ifndef QT_SIZEPOLICY_CONSTEXPR
+# define QT_SIZEPOLICY_CONSTEXPR
+#endif
+#ifndef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
+# define QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
+#endif
+#ifndef QT_SIZEPOLICY_RETURN_BITS
+# define QT_SIZEPOLICY_RETURN_BITS(E1, E2, E3, E4, E5, E6, E7, E8) \
+ const Bits result = { E1, E2, E3, E4, E5, E6, E7, E8 }; return result
+#endif
class QVariant;
class QSizePolicy;
@@ -54,7 +77,6 @@ Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) Q_DECL_N
class Q_WIDGETS_EXPORT QSizePolicy
{
Q_GADGET
- Q_FLAGS(ControlTypes)
public:
enum PolicyFlag {
@@ -93,8 +115,9 @@ public:
ToolButton = 0x00004000
};
Q_DECLARE_FLAGS(ControlTypes, ControlType)
+ Q_FLAG(ControlTypes)
- QSizePolicy() : data(0) { }
+ QT_SIZEPOLICY_CONSTEXPR QSizePolicy() : data(0) { }
QSizePolicy(Policy horizontal, Policy vertical, ControlType type = DefaultType)
: data(0) {
@@ -102,48 +125,56 @@ public:
bits.verPolicy = vertical;
setControlType(type);
}
- Policy horizontalPolicy() const { return static_cast<Policy>(bits.horPolicy); }
- Policy verticalPolicy() const { return static_cast<Policy>(bits.verPolicy); }
+ QT_SIZEPOLICY_CONSTEXPR Policy horizontalPolicy() const { return static_cast<Policy>(bits.horPolicy); }
+ QT_SIZEPOLICY_CONSTEXPR Policy verticalPolicy() const { return static_cast<Policy>(bits.verPolicy); }
ControlType controlType() const;
void setHorizontalPolicy(Policy d) { bits.horPolicy = d; }
void setVerticalPolicy(Policy d) { bits.verPolicy = d; }
void setControlType(ControlType type);
- Qt::Orientations expandingDirections() const {
+ QT_SIZEPOLICY_CONSTEXPR Qt::Orientations expandingDirections() const {
return ( (verticalPolicy() & ExpandFlag) ? Qt::Vertical : Qt::Orientations() )
| ( (horizontalPolicy() & ExpandFlag) ? Qt::Horizontal : Qt::Orientations() ) ;
}
- void setHeightForWidth(bool b) { bits.hfw = b; }
- bool hasHeightForWidth() const { return bits.hfw; }
+ void setHeightForWidth(bool b) { bits.hfw = b; }
+ QT_SIZEPOLICY_CONSTEXPR bool hasHeightForWidth() const { return bits.hfw; }
void setWidthForHeight(bool b) { bits.wfh = b; }
- bool hasWidthForHeight() const { return bits.wfh; }
+ QT_SIZEPOLICY_CONSTEXPR bool hasWidthForHeight() const { return bits.wfh; }
- bool operator==(const QSizePolicy& s) const { return data == s.data; }
- bool operator!=(const QSizePolicy& s) const { return data != s.data; }
+ QT_SIZEPOLICY_CONSTEXPR bool operator==(const QSizePolicy& s) const { return data == s.data; }
+ QT_SIZEPOLICY_CONSTEXPR bool operator!=(const QSizePolicy& s) const { return data != s.data; }
friend Q_DECL_CONST_FUNCTION uint qHash(QSizePolicy key, uint seed) Q_DECL_NOTHROW { return qHash(key.data, seed); }
operator QVariant() const;
- int horizontalStretch() const { return static_cast<int>(bits.horStretch); }
- int verticalStretch() const { return static_cast<int>(bits.verStretch); }
+ QT_SIZEPOLICY_CONSTEXPR int horizontalStretch() const { return static_cast<int>(bits.horStretch); }
+ QT_SIZEPOLICY_CONSTEXPR int verticalStretch() const { return static_cast<int>(bits.verStretch); }
void setHorizontalStretch(int stretchFactor) { bits.horStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
void setVerticalStretch(int stretchFactor) { bits.verStretch = static_cast<quint32>(qBound(0, stretchFactor, 255)); }
- bool retainSizeWhenHidden() const { return bits.retainSizeWhenHidden; }
+ QT_SIZEPOLICY_CONSTEXPR bool retainSizeWhenHidden() const { return bits.retainSizeWhenHidden; }
void setRetainSizeWhenHidden(bool retainSize) { bits.retainSizeWhenHidden = retainSize; }
void transpose();
-
+#ifndef Q_QDOC
+ QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
+#endif
+ QSizePolicy transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT
+ {
+ return QSizePolicy(bits.transposed());
+ }
private:
#ifndef QT_NO_DATASTREAM
friend Q_WIDGETS_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
friend Q_WIDGETS_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
#endif
- QSizePolicy(int i) : data(i) { }
+ QT_SIZEPOLICY_CONSTEXPR QSizePolicy(int i) : data(i) { }
+ struct Bits;
+ QT_SIZEPOLICY_CONSTEXPR explicit QSizePolicy(Bits b) Q_DECL_NOTHROW : bits(b) { }
struct Bits {
quint32 horStretch : 8;
@@ -154,6 +185,19 @@ private:
quint32 hfw : 1;
quint32 wfh : 1;
quint32 retainSizeWhenHidden : 1;
+
+ QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
+ Bits transposed() const Q_DECL_NOTHROW
+ {
+ QT_SIZEPOLICY_RETURN_BITS(verStretch, // \ swap
+ horStretch, // /
+ verPolicy, // \ swap
+ horPolicy, // /
+ ctype,
+ hfw, // \ don't swap (historic behavior)
+ wfh, // /
+ retainSizeWhenHidden);
+ }
};
union {
Bits bits;
@@ -187,6 +231,10 @@ inline void QSizePolicy::transpose() {
setVerticalStretch(hStretch);
}
+#undef QT_SIZEPOLICY_CONSTEXPR
+#undef QT_SIZEPOLICY_CONSTEXPR_AND_UNIFORM_INIT
+#undef QT_SIZEPOLICY_RETURN_BITS
+
QT_END_NAMESPACE
#endif // QSIZEPOLICY_H
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index cf90df6b9b..759821a057 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -5246,8 +5246,6 @@ static void sendResizeEvents(QWidget *target)
\sa render(), QPixmap
*/
-
-/* INVOKABLE since used by QPixmap::grabWidget(). */
QPixmap QWidget::grab(const QRect &rectangle)
{
Q_D(QWidget);
@@ -6593,11 +6591,6 @@ void QWidget::setFocus(Qt::FocusReason reason)
} else {
f->d_func()->updateFocusChild();
}
-
- if (QTLWExtra *extra = f->window()->d_func()->maybeTopData()) {
- if (extra->window)
- emit extra->window->focusObjectChanged(f);
- }
}
void QWidgetPrivate::setFocus_sys()
@@ -6632,6 +6625,11 @@ void QWidgetPrivate::updateFocusChild()
w = w->isWindow() ? 0 : w->parentWidget();
}
}
+
+ if (QTLWExtra *extra = q->window()->d_func()->maybeTopData()) {
+ if (extra->window)
+ emit extra->window->focusObjectChanged(q);
+ }
}
/*!
@@ -6673,9 +6671,15 @@ void QWidget::clearFocus()
w->d_func()->focus_child = 0;
w = w->parentWidget();
}
- // Since focus_child is the basis for the top level QWidgetWindow's focusObject()
- // we need to report this change to the rest of Qt, but we match setFocus() and
- // do it at the end of the function.
+
+ // Since we've unconditionally cleared the focus_child of our parents, we need
+ // to report this to the rest of Qt. Note that the focus_child is not the same
+ // thing as the application's focusWidget, which is why this piece of code is
+ // not inside the hasFocus() block below.
+ if (QTLWExtra *extra = window()->d_func()->maybeTopData()) {
+ if (extra->window)
+ emit extra->window->focusObjectChanged(extra->window->focusObject());
+ }
#ifndef QT_NO_GRAPHICSVIEW
QWExtra *topData = d_func()->extra;
@@ -6698,15 +6702,6 @@ void QWidget::clearFocus()
#endif
}
}
-
- // Since we've unconditionally cleared the focus_child of our parents, we need
- // to report this to the rest of Qt. Note that the focus_child is not the same
- // thing as the application's focusWidget, which is why this piece of code is
- // not inside the hasFocus() block above.
- if (QTLWExtra *extra = window()->d_func()->maybeTopData()) {
- if (extra->window)
- emit extra->window->focusObjectChanged(extra->window->focusObject());
- }
}
@@ -10353,7 +10348,7 @@ void QWidget::updateGeometry()
a window, causing the widget to be hidden. You must call show() to make
the widget visible again..
- \sa windowType(), {Window Flags Example}
+ \sa windowType(), setWindowFlag(), {Window Flags Example}
*/
void QWidget::setWindowFlags(Qt::WindowFlags flags)
{
@@ -10361,6 +10356,23 @@ void QWidget::setWindowFlags(Qt::WindowFlags flags)
d->setWindowFlags(flags);
}
+/*!
+ \since 5.9
+
+ Sets the window flag \a flag on this widget if \a on is true;
+ otherwise clears the flag.
+
+ \sa setWindowFlags(), windowFlags(), windowType()
+*/
+void QWidget::setWindowFlag(Qt::WindowType flag, bool on)
+{
+ Q_D(QWidget);
+ if (on)
+ d->setWindowFlags(data->window_flags | flag);
+ else
+ d->setWindowFlags(data->window_flags & ~flag);
+}
+
/*! \internal
Implemented in QWidgetPrivate so that QMdiSubWindowPrivate can reimplement it.
@@ -12710,7 +12722,6 @@ void QWidget::activateWindow()
}
/*!
- \fn int QWidget::metric(PaintDeviceMetric m) const
Internal implementation of the virtual QPaintDevice::metric()
function.
@@ -12934,6 +12945,9 @@ void QWidget::setMask(const QBitmap &bitmap)
*/
void QWidget::clearMask()
{
+ Q_D(QWidget);
+ if (!d->extra || !d->extra->hasMask)
+ return;
setMask(QRegion());
}
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 58413c6bd3..4c80038a4f 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -562,6 +562,7 @@ public:
void setWindowFlags(Qt::WindowFlags type);
inline Qt::WindowFlags windowFlags() const;
+ void setWindowFlag(Qt::WindowType, bool on = true);
void overrideWindowFlags(Qt::WindowFlags type);
inline Qt::WindowType windowType() const;
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 3e15b6977a..7295cc36f6 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -957,8 +957,8 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event
// Sent event if the state changed (that is, it is not triggered by
// QWidget::setWindowState(), which also sends an event to the widget).
- if (widgetState != int(m_widget->data->window_state)) {
- m_widget->data->window_state = widgetState;
+ if (widgetState != Qt::WindowStates::Int(m_widget->data->window_state)) {
+ m_widget->data->window_state = uint(widgetState);
QWindowStateChangeEvent widgetEvent(eventState);
QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent);
}
diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h
index edf2383596..a81355160e 100644
--- a/src/widgets/kernel/qwidgetwindow_p.h
+++ b/src/widgets/kernel/qwidgetwindow_p.h
@@ -56,6 +56,7 @@
#include <QtCore/private/qobject_p.h>
#include <QtGui/private/qevent_p.h>
+#include <QtWidgets/qwidget.h>
QT_BEGIN_NAMESPACE