summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-08-15 16:30:10 +0200
committerLiang Qi <liang.qi@qt.io>2017-08-15 16:31:48 +0200
commit106d3b9bf93325ea93c678270290b2c3dda9b764 (patch)
tree26c56932d60964c83e81d9c33d6f37ebc36d6c56 /src/widgets/kernel
parent79f679da9483c12979500dd48bc096d33af9ca6f (diff)
parent8bebded9ab02b8eec67c44bfddf802d6bf9cda3c (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: src/plugins/platforms/cocoa/qcocoamenu.h src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/widgets/styles/qstylehelper_p.h Change-Id: I54247c98dd79d2b3826fc062b8b11048c9c7d9bb
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qaction.cpp8
-rw-r--r--src/widgets/kernel/qaction.h2
-rw-r--r--src/widgets/kernel/qaction_p.h4
-rw-r--r--src/widgets/kernel/qapplication.cpp34
-rw-r--r--src/widgets/kernel/qapplication_p.h2
-rw-r--r--src/widgets/kernel/qgesture.cpp6
-rw-r--r--src/widgets/kernel/qgesture.h2
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp8
-rw-r--r--src/widgets/kernel/qgesturemanager_p.h4
-rw-r--r--src/widgets/kernel/qshortcut.cpp10
-rw-r--r--src/widgets/kernel/qstandardgestures.cpp8
-rw-r--r--src/widgets/kernel/qwidget.cpp88
-rw-r--r--src/widgets/kernel/qwidget.h2
-rw-r--r--src/widgets/kernel/qwidget_p.h8
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp8
15 files changed, 106 insertions, 88 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 57b1f31188..a7116b1462 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -114,7 +114,7 @@ void QActionPrivate::sendDataChanged()
QWidget *w = widgets.at(i);
QApplication::sendEvent(w, &e);
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
for (int i = 0; i < graphicsWidgets.size(); ++i) {
QGraphicsWidget *w = graphicsWidgets.at(i);
QApplication::sendEvent(w, &e);
@@ -279,6 +279,8 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
/*!
Constructs an action with \a parent. If \a parent is an action
group the action will be automatically inserted into the group.
+
+ \note The \a parent argument is optional since Qt 5.7.
*/
QAction::QAction(QObject* parent)
: QAction(*new QActionPrivate, parent)
@@ -360,7 +362,7 @@ QList<QWidget *> QAction::associatedWidgets() const
return d->widgets;
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
/*!
\since 4.5
Returns a list of widgets this action has been added to.
@@ -565,7 +567,7 @@ QAction::~QAction()
QWidget *w = d->widgets.at(i);
w->removeAction(this);
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
for (int i = d->graphicsWidgets.size()-1; i >= 0; --i) {
QGraphicsWidget *w = d->graphicsWidgets.at(i);
w->removeAction(this);
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index d211016931..ca127ef51a 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -175,7 +175,7 @@ public:
QWidget *parentWidget() const;
QList<QWidget *> associatedWidgets() const;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QList<QGraphicsWidget *> associatedGraphicsWidgets() const; // ### suboptimal
#endif
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index 6813ca08f6..4c1537b63b 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -54,7 +54,9 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "QtWidgets/qaction.h"
#include "QtWidgets/qmenu.h"
+#if QT_CONFIG(graphicsview)
#include "private/qgraphicswidget_p.h"
+#endif
#include "private/qobject_p.h"
QT_BEGIN_NAMESPACE
@@ -112,7 +114,7 @@ public:
QAction::Priority priority;
QList<QWidget *> widgets;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QList<QGraphicsWidget *> graphicsWidgets;
#endif
#ifndef QT_NO_SHORTCUT
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 09162b9ab4..ee61a25b09 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -47,7 +47,10 @@
#include "qevent.h"
#include "qfile.h"
#include "qfileinfo.h"
+#if QT_CONFIG(graphicsview)
#include "qgraphicsscene.h"
+#include <QtWidgets/qgraphicsproxywidget.h>
+#endif
#include "qhash.h"
#include "qset.h"
#include "qlayout.h"
@@ -70,7 +73,6 @@
#include "qmessagebox.h"
#endif
#include "qwidgetwindow_p.h"
-#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtGui/qstylehints.h>
#include <QtGui/qinputmethod.h>
#include <QtGui/private/qwindow_p.h>
@@ -1443,13 +1445,13 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char*
}
// Send to all scenes as well.
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QList<QGraphicsScene *> &scenes = qApp->d_func()->scene_list;
for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin();
it != scenes.constEnd(); ++it) {
QApplication::sendEvent(*it, &e);
}
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
}
if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) {
if (!QApplicationPrivate::set_pal)
@@ -1627,14 +1629,14 @@ void QApplication::setFont(const QFont &font, const char *className)
sendEvent(w, &e);
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
// Send to all scenes as well.
QList<QGraphicsScene *> &scenes = qApp->d_func()->scene_list;
for (QList<QGraphicsScene *>::ConstIterator it = scenes.constBegin();
it != scenes.constEnd(); ++it) {
QApplication::sendEvent(*it, &e);
}
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
}
if (!className && (!QApplicationPrivate::sys_font || !font.isCopyOf(*QApplicationPrivate::sys_font))) {
if (!QApplicationPrivate::set_font)
@@ -1769,7 +1771,7 @@ QWidget *QApplication::focusWidget()
void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
{
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (focus && focus->window()->graphicsProxyWidget())
return;
#endif
@@ -2076,7 +2078,7 @@ void QApplication::setActiveWindow(QWidget* act)
if (QApplicationPrivate::active_window == window)
return;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (window && window->graphicsProxyWidget()) {
// Activate the proxy's view->viewport() ?
return;
@@ -2386,7 +2388,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
//check that we will not call qt_x11_enforce_cursor twice with the same native widget
if (parentOfLeavingCursor && (!enterOnAlien
|| parentOfLeavingCursor->effectiveWinId() != enter->effectiveWinId())) {
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (!parentOfLeavingCursor->window()->graphicsProxyWidget())
#endif
{
@@ -2405,7 +2407,7 @@ void QApplicationPrivate::dispatchEnterLeave(QWidget* enter, QWidget* leave, con
if (!cursorWidget)
return;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (cursorWidget->window()->graphicsProxyWidget()) {
QWidgetPrivate::nearestGraphicsProxyWidget(cursorWidget)->setCursor(cursorWidget->cursor());
} else
@@ -3099,7 +3101,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
case QEvent::KeyRelease:
{
bool isWidget = receiver->isWidgetType();
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
const bool isGraphicsWidget = !isWidget && qobject_cast<QGraphicsWidget *>(receiver);
#endif
QKeyEvent* key = static_cast<QKeyEvent*>(e);
@@ -3111,7 +3113,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
else
key->ignore();
QWidget *w = isWidget ? static_cast<QWidget *>(receiver) : 0;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QGraphicsWidget *gw = isGraphicsWidget ? static_cast<QGraphicsWidget *>(receiver) : 0;
#endif
res = d->notify_helper(receiver, e);
@@ -3131,14 +3133,14 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
*/
|| !pr
|| (isWidget && (w->isWindow() || !w->parentWidget()))
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
|| (isGraphicsWidget && (gw->isWindow() || !gw->parentWidget()))
#endif
) {
break;
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
receiver = w ? (QObject *)w->parentWidget() : (QObject *)gw->parentWidget();
#else
receiver = w->parentWidget();
@@ -3431,7 +3433,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
case QEvent::DragEnter: {
QWidget* w = static_cast<QWidget *>(receiver);
QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(e);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
// QGraphicsProxyWidget handles its own propagation,
// and we must not change QDragManagers currentTarget.
QWExtra *extra = w->window()->d_func()->extra;
@@ -3459,7 +3461,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
case QEvent::Drop:
case QEvent::DragLeave: {
QWidget* w = static_cast<QWidget *>(receiver);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
// QGraphicsProxyWidget handles its own propagation,
// and we must not change QDragManagers currentTarget.
QWExtra *extra = w->window()->d_func()->extra;
@@ -3481,7 +3483,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
res = d->notify_helper(w, e);
if (e->type() != QEvent::DragMove
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
&& !isProxyWidget
#endif
)
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 1bd114aad7..5dca2e85f1 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -165,7 +165,7 @@ public:
static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next,
bool *wrappingOccurred = 0);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
// Maintain a list of all scenes to ensure font and palette propagation to
// all scenes.
QList<QGraphicsScene *> scene_list;
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index 3962cbe6c5..7f8bf18e90 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -40,7 +40,9 @@
#include "qgesture.h"
#include "private/qgesture_p.h"
#include "private/qstandardgestures_p.h"
+#if QT_CONFIG(graphicsview)
#include "qgraphicsview.h"
+#endif
#include <private/qdebug_p.h>
#ifndef QT_NO_GESTURES
@@ -1067,7 +1069,7 @@ QWidget *QGestureEvent::widget() const
return m_widget;
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
/*!
Returns the scene-local coordinates if the \a gesturePoint is inside a
graphics view.
@@ -1089,7 +1091,7 @@ QPointF QGestureEvent::mapToGraphicsScene(const QPointF &gesturePoint) const
}
return QPointF();
}
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 4dd6e82fd1..1eda611d64 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -301,7 +301,7 @@ public:
void setWidget(QWidget *widget);
QWidget *widget() const;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QPointF mapToGraphicsScene(const QPointF &gesturePoint) const;
#endif
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index cfa4246455..fca36c7472 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -41,13 +41,15 @@
#include "private/qstandardgestures_p.h"
#include "private/qwidget_p.h"
#include "private/qgesture_p.h"
+#if QT_CONFIG(graphicsview)
#include "private/qgraphicsitem_p.h"
+#include "qgraphicsitem.h"
+#endif
#include "private/qevent_p.h"
#include "private/qapplication_p.h"
#include "private/qwidgetwindow_p.h"
#include "qgesture.h"
#include "qevent.h"
-#include "qgraphicsitem.h"
#ifdef Q_OS_OSX
#include "qmacgesturerecognizer_p.h"
@@ -207,7 +209,7 @@ QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recogni
return 0;
} else if (QGesture *g = qobject_cast<QGesture *>(object)) {
return g;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
} else {
Q_ASSERT(qobject_cast<QGraphicsObject *>(object));
QGraphicsObject *graphicsObject = static_cast<QGraphicsObject *>(object);
@@ -510,7 +512,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event)
return contexts.isEmpty() ? false : filterEventThroughContexts(contexts, event);
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event)
{
QMap<Qt::GestureType, int> types;
diff --git a/src/widgets/kernel/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h
index ec51466a63..e57652afba 100644
--- a/src/widgets/kernel/qgesturemanager_p.h
+++ b/src/widgets/kernel/qgesturemanager_p.h
@@ -75,9 +75,9 @@ public:
bool filterEvent(QWidget *receiver, QEvent *event);
bool filterEvent(QObject *receiver, QEvent *event);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
bool filterEvent(QGraphicsObject *receiver, QEvent *event);
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
static QGestureManager* instance(); // declared in qapplication.cpp
static bool gesturePending(QObject *o);
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index a09cba0ddc..891cf563d6 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window);
#endif
#ifndef QT_NO_ACTION
@@ -110,7 +110,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
return correctActionContext(context, a, active_window);
#endif
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QGraphicsWidget *gw = qobject_cast<QGraphicsWidget *>(object))
return correctGraphicsWidgetContext(context, gw, active_window);
#endif
@@ -168,7 +168,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
// Below is Qt::WindowShortcut context
QWidget *tlw = w->window();
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QWExtra *topData = static_cast<QWidgetPrivate *>(QObjectPrivate::get(tlw))->extra) {
if (topData->proxyWidget) {
bool res = correctGraphicsWidgetContext(context, (QGraphicsWidget *)topData->proxyWidget, active_window);
@@ -204,7 +204,7 @@ static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidge
return true;
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window)
{
bool visible = w->isVisible();
@@ -298,7 +298,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
return true;
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
const QList<QGraphicsWidget *> &graphicsWidgets = static_cast<QActionPrivate *>(QObjectPrivate::get(a))->graphicsWidgets;
#if defined(DEBUG_QSHORTCUTMAP)
if (graphicsWidgets.isEmpty())
diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp
index 759c9864a6..8a95b12d89 100644
--- a/src/widgets/kernel/qstandardgestures.cpp
+++ b/src/widgets/kernel/qstandardgestures.cpp
@@ -43,7 +43,9 @@
#include "qevent.h"
#include "qwidget.h"
#include "qabstractscrollarea.h"
+#if QT_CONFIG(graphicsview)
#include <qgraphicssceneevent.h>
+#endif
#include "qdebug.h"
#ifndef QT_NO_GESTURES
@@ -511,7 +513,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
enum { TapRadius = 40 };
switch (event->type()) {
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
case QEvent::GraphicsSceneMousePress: {
const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
d->position = gsme->screenPos();
@@ -540,7 +542,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
d->timerId = q->startTimer(QTapAndHoldGesturePrivate::Timeout);
return QGestureRecognizer::MayBeGesture; // we don't show a sign of life until the timeout
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
case QEvent::GraphicsSceneMouseRelease:
#endif
case QEvent::MouseButtonRelease:
@@ -563,7 +565,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
return QGestureRecognizer::MayBeGesture;
return QGestureRecognizer::CancelGesture;
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
case QEvent::GraphicsSceneMouseMove: {
const QGraphicsSceneMouseEvent *gsme = static_cast<const QGraphicsSceneMouseEvent *>(event);
QPoint delta = gsme->screenPos() - d->position.toPoint();
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index c6b3e31747..2b4c70ed2b 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -97,9 +97,11 @@
#include <QtGui/private/qwindow_p.h>
#include "qaction_p.h"
#include "qlayout_p.h"
+#if QT_CONFIG(graphicsview)
#include "QtWidgets/qgraphicsproxywidget.h"
#include "QtWidgets/qgraphicsscene.h"
#include "private/qgraphicsproxywidget_p.h"
+#endif
#include "QtWidgets/qabstractscrollarea.h"
#include "private/qabstractscrollarea_p.h"
#include "private/qevent_p.h"
@@ -1614,7 +1616,7 @@ QWidget::~QWidget()
QT_TRY {
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
const QWidget* w = this;
while (w->d_func()->extra && w->d_func()->extra->focus_proxy)
w = w->d_func()->extra->focus_proxy;
@@ -1801,7 +1803,7 @@ void QWidgetPrivate::createExtra()
extra = new QWExtra;
extra->glContext = 0;
extra->topextra = 0;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
extra->proxyWidget = 0;
#endif
#ifndef QT_NO_CURSOR
@@ -2017,12 +2019,12 @@ void QWidgetPrivate::propagatePaletteChange()
{
Q_Q(QWidget);
// Propagate a new inherited mask to all children.
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (!q->parentWidget() && extra && extra->proxyWidget) {
QGraphicsProxyWidget *p = extra->proxyWidget;
inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve();
} else
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
inheritedPaletteResolveMask = 0;
}
@@ -4025,7 +4027,7 @@ void QWidget::setMinimumSize(int minw, int minh)
if (maximized)
data->window_state = data->window_state | Qt::WindowMaximized;
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (d->extra) {
if (d->extra->proxyWidget)
d->extra->proxyWidget->setMinimumSize(minw, minh);
@@ -4083,7 +4085,7 @@ void QWidget::setMaximumSize(int maxw, int maxh)
setAttribute(Qt::WA_Resized, resized); //not a user resize
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (d->extra) {
if (d->extra->proxyWidget)
d->extra->proxyWidget->setMaximumSize(maxw, maxh);
@@ -4601,9 +4603,9 @@ QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const
QPalette naturalPalette = QApplication::palette(q);
if ((!q->testAttribute(Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles)
&& (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
|| (extra && extra->proxyWidget)
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
)) {
if (QWidget *p = q->parentWidget()) {
if (!p->testAttribute(Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles) {
@@ -4616,13 +4618,13 @@ QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const
}
}
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
else if (extra && extra->proxyWidget) {
QPalette inheritedPalette = extra->proxyWidget->palette();
inheritedPalette.resolve(inheritedMask);
naturalPalette = inheritedPalette.resolve(naturalPalette);
}
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
}
naturalPalette.resolve(0);
return naturalPalette;
@@ -4749,9 +4751,9 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const
QFont naturalFont = QApplication::font(q);
if ((!q->testAttribute(Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles)
&& (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation)
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
|| (extra && extra->proxyWidget)
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
)) {
if (QWidget *p = q->parentWidget()) {
if (!p->testAttribute(Qt::WA_StyleSheet) || useStyleSheetPropagationInWidgetStyles) {
@@ -4766,7 +4768,7 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const
}
}
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
else if (extra && extra->proxyWidget) {
if (inheritedMask != 0) {
QFont inheritedFont = extra->proxyWidget->font();
@@ -4774,7 +4776,7 @@ QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const
naturalFont = inheritedFont.resolve(naturalFont);
} // else nothing to do (naturalFont = naturalFont)
}
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
}
naturalFont.resolve(0);
return naturalFont;
@@ -4820,12 +4822,12 @@ void QWidgetPrivate::updateFont(const QFont &font)
data.fnt.x11SetScreen(xinfo.screen());
#endif
// Combine new mask with natural mask and propagate to children.
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (!q->parentWidget() && extra && extra->proxyWidget) {
QGraphicsProxyWidget *p = extra->proxyWidget;
inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();
} else
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
inheritedFontResolveMask = 0;
}
@@ -5825,9 +5827,9 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis
}
if (w->updatesEnabled()
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
&& (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)
-#endif //QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
) {
QRegion wRegion(rgn);
wRegion &= wd->effectiveRectFor(w->data->crect);
@@ -5915,7 +5917,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *
}
#endif // QT_CONFIG(graphicseffect)
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
/*!
\internal
@@ -6466,13 +6468,13 @@ bool QWidget::hasFocus() const
const QWidget* w = this;
while (w->d_func()->extra && w->d_func()->extra->focus_proxy)
w = w->d_func()->extra->focus_proxy;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QWidget *window = w->window()) {
QWExtra *e = window->d_func()->extra;
if (e && e->proxyWidget && e->proxyWidget->hasFocus() && window->focusWidget() == w)
return true;
}
-#endif // !QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
return (QApplication::focusWidget() == w);
}
@@ -6527,7 +6529,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
)
return;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QWidget *previousProxyFocus = 0;
if (QWExtra *topData = window()->d_func()->extra) {
if (topData->proxyWidget && topData->proxyWidget->hasFocus()) {
@@ -6540,7 +6542,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
}
#endif
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
// Update proxy state
if (QWExtra *topData = window()->d_func()->extra) {
if (topData->proxyWidget && !topData->proxyWidget->hasFocus()) {
@@ -6582,7 +6584,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
QAccessible::updateAccessibility(&event);
}
#endif
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QWExtra *topData = window()->d_func()->extra) {
if (topData->proxyWidget) {
if (previousProxyFocus && previousProxyFocus != f) {
@@ -6594,7 +6596,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
QApplication::sendEvent(that->style(), &event);
}
if (!isHidden()) {
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
// Update proxy state
if (QWExtra *topData = window()->d_func()->extra)
if (topData->proxyWidget && topData->proxyWidget->hasFocus())
@@ -6703,7 +6705,7 @@ void QWidget::clearFocus()
emit extra->window->focusObjectChanged(extra->window->focusObject());
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QWExtra *topData = d_func()->extra;
if (topData && topData->proxyWidget)
topData->proxyWidget->clearFocus();
@@ -6775,7 +6777,7 @@ bool QWidget::focusNextPrevChild(bool next)
bool isSubWindow = (windowType() == Qt::SubWindow);
if (!isWindow() && !isSubWindow && p)
return p->focusNextPrevChild(next);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
Q_D(QWidget);
if (d->extra && d->extra->proxyWidget)
return d->extra->proxyWidget->focusNextPrevChild(next);
@@ -6869,7 +6871,7 @@ bool QWidget::isActiveWindow() const
if(tlw == QApplication::activeWindow() || (isVisible() && (tlw->windowType() == Qt::Popup)))
return true;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QWExtra *tlwExtra = tlw->d_func()->extra) {
if (isVisible() && tlwExtra->proxyWidget)
return tlwExtra->proxyWidget->isActiveWindow();
@@ -7880,7 +7882,7 @@ void QWidgetPrivate::show_helper()
const bool isWindow = q->isWindow();
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
bool isEmbedded = isWindow && q->graphicsProxyWidget() != Q_NULLPTR;
#else
bool isEmbedded = false;
@@ -7904,7 +7906,7 @@ void QWidgetPrivate::show_helper()
// Automatic embedding of child windows of widgets already embedded into
// QGraphicsProxyWidget when they are shown the first time.
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (isWindow) {
if (!isEmbedded && !bypassGraphicsProxyWidget(q)) {
QGraphicsProxyWidget *ancestorProxy = nearestGraphicsProxyWidget(q->parentWidget());
@@ -7967,7 +7969,7 @@ void QWidgetPrivate::show_sys()
q->setAttribute(Qt::WA_Mapped);
// add our window the modal window list (native dialogs)
if (window && q->isWindow()
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
&& (!extra || !extra->proxyWidget)
#endif
&& q->windowModality() != Qt::NonModal) {
@@ -8041,7 +8043,7 @@ void QWidgetPrivate::hide_helper()
Q_Q(QWidget);
bool isEmbedded = false;
-#if !defined QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
isEmbedded = q->isWindow() && !bypassGraphicsProxyWidget(q) && nearestGraphicsProxyWidget(q->parentWidget()) != 0;
#else
Q_UNUSED(isEmbedded);
@@ -8105,7 +8107,7 @@ void QWidgetPrivate::hide_sys()
q->setAttribute(Qt::WA_Mapped, false);
// remove our window from the modal window list (native dialogs)
if (window && q->isWindow()
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
&& (!extra || !extra->proxyWidget)
#endif
&& q->windowModality() != Qt::NonModal) {
@@ -10224,7 +10226,7 @@ void QWidget::setSizePolicy(QSizePolicy policy)
d->size_policy = policy;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QWExtra *extra = d->extra) {
if (extra->proxyWidget)
extra->proxyWidget->setSizePolicy(policy);
@@ -10655,7 +10657,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
d->updateIsOpaque();
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
// Embed the widget into a proxy if the parent is embedded.
// ### Doesn't handle reparenting out of an embedded widget.
if (oldtlw->graphicsProxyWidget()) {
@@ -10797,7 +10799,7 @@ void QWidget::scroll(int dx, int dy)
if (dx == 0 && dy == 0)
return;
Q_D(QWidget);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
// Graphics View maintains its own dirty region as a list of rects;
// until we can connect item updates directly to the view, we must
@@ -10837,7 +10839,7 @@ void QWidget::scroll(int dx, int dy, const QRect &r)
if (dx == 0 && dy == 0)
return;
Q_D(QWidget);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
// Graphics View maintains its own dirty region as a list of rects;
// until we can connect item updates directly to the view, we must
@@ -11416,7 +11418,7 @@ void QWidget::setWindowOpacity(qreal opacity)
if (!testAttribute(Qt::WA_WState_Created))
return;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QGraphicsProxyWidget *proxy = graphicsProxyWidget()) {
// Avoid invalidating the cache if set.
if (proxy->cacheMode() == QGraphicsItem::NoCache)
@@ -12283,7 +12285,7 @@ Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget)
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
/*!
\since 4.5
@@ -12433,7 +12435,7 @@ static inline bool canMapPosition(QWindow *window)
return window->handle() && !qt_window_private(window)->resizeEventPending;
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
static inline QGraphicsProxyWidget *graphicsProxyWidget(const QWidget *w)
{
QGraphicsProxyWidget *result = Q_NULLPTR;
@@ -12442,7 +12444,7 @@ static inline QGraphicsProxyWidget *graphicsProxyWidget(const QWidget *w)
result = d->extra->proxyWidget;
return result;
}
-#endif // !QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
struct MapToGlobalTransformResult {
QTransform transform;
@@ -12454,7 +12456,7 @@ static MapToGlobalTransformResult mapToGlobalTransform(const QWidget *w)
MapToGlobalTransformResult result;
result.window = Q_NULLPTR;
for ( ; w ; w = w->parentWidget()) {
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (QGraphicsProxyWidget *qgpw = graphicsProxyWidget(w)) {
if (const QGraphicsScene *scene = qgpw->scene()) {
const QList <QGraphicsView *> views = scene->views();
@@ -12465,7 +12467,7 @@ static MapToGlobalTransformResult mapToGlobalTransform(const QWidget *w)
}
}
}
-#endif // !QT_NO_GRAPHICSVIEW
+#endif // QT_CONFIG(graphicsview)
QWindow *window = w->windowHandle();
if (window && canMapPosition(window)) {
result.window = window;
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 3b0678d349..732af4de09 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -451,7 +451,7 @@ public:
inline bool updatesEnabled() const;
void setUpdatesEnabled(bool enable);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QGraphicsProxyWidget *graphicsProxyWidget() const;
#endif
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 85214e4bd7..f1eefd68dd 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -67,9 +67,11 @@
#if QT_CONFIG(graphicseffect)
#include <private/qgraphicseffect_p.h>
#endif
+#if QT_CONFIG(graphicsview)
#include "QtWidgets/qgraphicsproxywidget.h"
#include "QtWidgets/qgraphicsscene.h"
#include "QtWidgets/qgraphicsview.h"
+#endif
#include <private/qgesture_p.h>
#include <qpa/qplatformbackingstore.h>
@@ -233,7 +235,7 @@ struct QWExtra {
// Regular pointers (keep them together to avoid gaps on 64 bits architectures).
void *glContext; // if the widget is hijacked by QGLWindowSurface
QTLWExtra *topextra; // only useful for TLWs
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QGraphicsProxyWidget *proxyWidget; // if the widget is embedded
#endif
#ifndef QT_NO_CURSOR
@@ -406,7 +408,7 @@ public:
const QRegion &rgn, const QPoint &offset, int flags,
QPainter *sharedPainter, QWidgetBackingStore *backingStore);
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin);
#endif
void repaint_sys(const QRegion &rgn);
@@ -534,7 +536,7 @@ public:
static QRect screenGeometry(const QWidget *widget)
{
QRect screen;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget);
//It's embedded if it has an ancestor
if (ancestorProxy) {
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 046bf743ab..bb421927db 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -48,7 +48,9 @@
#include <QtGui/qevent.h>
#include <QtWidgets/qapplication.h>
#include <QtGui/qpaintengine.h>
+#if QT_CONFIG(graphicsview)
#include <QtWidgets/qgraphicsproxywidget.h>
+#endif
#include <private/qwidget_p.h>
#include <private/qapplication_p.h>
@@ -821,7 +823,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy)
const bool nativeWithTextureChild = textureChildSeen && q->internalWinId();
bool accelerateMove = accelEnv && isOpaque && !nativeWithTextureChild
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
// No accelerate move for proxy widgets.
&& !tlw->d_func()->extra->proxyWidget
#endif
@@ -1235,7 +1237,7 @@ void QWidgetBackingStore::doSync()
: wd->dirty);
toClean += widgetDirty;
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (tlw->d_func()->extra->proxyWidget) {
resetWidget(w);
continue;
@@ -1320,7 +1322,7 @@ void QWidgetBackingStore::doSync()
dirtyRenderToTextureWidgets.clear();
#endif
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (tlw->d_func()->extra->proxyWidget) {
updateStaticContentsSize();
dirty = QRegion();