summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qaction.cpp6
-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, 104 insertions, 88 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 2314ab45f1..002ca68720 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -112,7 +112,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);
@@ -360,7 +360,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 +565,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 97948a2457..7dc4419d8e 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -172,7 +172,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 8ee71a5ff0..45394e0b52 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
@@ -111,7 +113,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 d2f4161297..26e9ffbbf0 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
@@ -3096,7 +3098,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);
@@ -3108,7 +3110,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);
@@ -3128,14 +3130,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();
@@ -3428,7 +3430,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;
@@ -3456,7 +3458,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;
@@ -3478,7 +3480,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 1a189cb2b9..36de3cacaa 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 2e5c2c53bd..2873703cb7 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"
@@ -209,7 +211,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);
@@ -512,7 +514,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 3d870fc5cc..d372d69d02 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -98,9 +98,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"
@@ -1615,7 +1617,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;
@@ -1802,7 +1804,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
@@ -2018,12 +2020,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;
}
@@ -4042,7 +4044,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);
@@ -4100,7 +4102,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);
@@ -4618,9 +4620,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) {
@@ -4633,13 +4635,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;
@@ -4766,9 +4768,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) {
@@ -4783,7 +4785,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();
@@ -4791,7 +4793,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;
@@ -4837,12 +4839,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;
}
@@ -5840,9 +5842,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);
@@ -5930,7 +5932,7 @@ QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *
}
#endif // QT_CONFIG(graphicseffect)
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
/*!
\internal
@@ -6481,13 +6483,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);
}
@@ -6542,7 +6544,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()) {
@@ -6555,7 +6557,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()) {
@@ -6597,7 +6599,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) {
@@ -6609,7 +6611,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())
@@ -6718,7 +6720,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();
@@ -6790,7 +6792,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);
@@ -6884,7 +6886,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();
@@ -7895,7 +7897,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;
@@ -7919,7 +7921,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());
@@ -7982,7 +7984,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) {
@@ -8056,7 +8058,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);
@@ -8120,7 +8122,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) {
@@ -10238,7 +10240,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);
@@ -10669,7 +10671,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()) {
@@ -10811,7 +10813,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
@@ -10851,7 +10853,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
@@ -11430,7 +11432,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)
@@ -12298,7 +12300,7 @@ Q_WIDGETS_EXPORT QWidgetPrivate *qt_widget_private(QWidget *widget)
}
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
/*!
\since 4.5
@@ -12448,7 +12450,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;
@@ -12457,7 +12459,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;
@@ -12469,7 +12471,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();
@@ -12480,7 +12482,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 e2affa802c..a24d13e0e1 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>
QT_BEGIN_NAMESPACE
@@ -232,7 +234,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
@@ -404,7 +406,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);
@@ -532,7 +534,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 2f4bcd6370..57564ce477 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>
@@ -823,7 +825,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
@@ -1239,7 +1241,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;
@@ -1324,7 +1326,7 @@ void QWidgetBackingStore::doSync()
dirtyRenderToTextureWidgets.clear();
#endif
-#ifndef QT_NO_GRAPHICSVIEW
+#if QT_CONFIG(graphicsview)
if (tlw->d_func()->extra->proxyWidget) {
updateStaticContentsSize();
dirty = QRegion();