From 1df7a6a50a794721edb1bc63d268378f4f0ed7c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@digia.com> Date: Thu, 23 May 2013 12:44:20 +0200 Subject: [PATCH] Move QBasicDrag and QSimpleDrag to QtGui. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are useful as default implementations of QPlatformIntegration::drag(), instead of having it return 0 which will lead to crashes in Qt Quick 2 and widgets applications that use drag and drop. Task-number: QTBUG-31288 Change-Id: I70efa139306ced5d879def0f74e3a72d3bcd64f7 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> --- src/gui/kernel/kernel.pri | 4 ++++ src/gui/kernel/qplatformintegration.cpp | 7 ++++++- .../dnd => gui/kernel}/qshapedpixmapdndwindow.cpp | 0 .../dnd => gui/kernel}/qshapedpixmapdndwindow_p.h | 0 src/{platformsupport/dnd => gui/kernel}/qsimpledrag.cpp | 2 +- src/{platformsupport/dnd => gui/kernel}/qsimpledrag_p.h | 4 ++-- src/platformsupport/dnd/dnd.pri | 6 ------ src/platformsupport/platformsupport.pro | 1 - src/plugins/platforms/cocoa/qcocoadrag.h | 2 +- src/plugins/platforms/qnx/qqnxintegration.cpp | 2 +- src/plugins/platforms/xcb/qxcbdrag.cpp | 4 ++-- src/plugins/platforms/xcb/qxcbdrag.h | 2 +- 12 files changed, 18 insertions(+), 16 deletions(-) rename src/{platformsupport/dnd => gui/kernel}/qshapedpixmapdndwindow.cpp (100%) rename src/{platformsupport/dnd => gui/kernel}/qshapedpixmapdndwindow_p.h (100%) rename src/{platformsupport/dnd => gui/kernel}/qsimpledrag.cpp (99%) rename src/{platformsupport/dnd => gui/kernel}/qsimpledrag_p.h (96%) delete mode 100644 src/platformsupport/dnd/dnd.pri diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 91374fe2dd2..3c019fc5b5d 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -31,6 +31,8 @@ HEADERS += \ kernel/qplatformclipboard.h \ kernel/qplatformnativeinterface.h \ kernel/qplatformmenu.h \ + kernel/qshapedpixmapdndwindow_p.h \ + kernel/qsimpledrag_p.h \ kernel/qsurfaceformat.h \ kernel/qguiapplication.h \ kernel/qguiapplication_p.h \ @@ -89,6 +91,8 @@ SOURCES += \ kernel/qplatformclipboard.cpp \ kernel/qplatformnativeinterface.cpp \ kernel/qsessionmanager.cpp \ + kernel/qshapedpixmapdndwindow.cpp \ + kernel/qsimpledrag.cpp \ kernel/qsurfaceformat.cpp \ kernel/qguiapplication.cpp \ kernel/qwindow.cpp \ diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index e82e30df808..e4f45ebb6eb 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -49,6 +49,7 @@ #include <QtGui/private/qpixmap_raster_p.h> #include <qpa/qplatformscreen_p.h> #include <private/qdnd_p.h> +#include <private/qsimpledrag_p.h> QT_BEGIN_NAMESPACE @@ -99,7 +100,11 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const */ QPlatformDrag *QPlatformIntegration::drag() const { - return 0; + static QSimpleDrag *drag = 0; + if (!drag) { + drag = new QSimpleDrag; + } + return drag; } #endif diff --git a/src/platformsupport/dnd/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp similarity index 100% rename from src/platformsupport/dnd/qshapedpixmapdndwindow.cpp rename to src/gui/kernel/qshapedpixmapdndwindow.cpp diff --git a/src/platformsupport/dnd/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h similarity index 100% rename from src/platformsupport/dnd/qshapedpixmapdndwindow_p.h rename to src/gui/kernel/qshapedpixmapdndwindow_p.h diff --git a/src/platformsupport/dnd/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp similarity index 99% rename from src/platformsupport/dnd/qsimpledrag.cpp rename to src/gui/kernel/qsimpledrag.cpp index f2ff1770557..f6912a2d577 100644 --- a/src/platformsupport/dnd/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -62,7 +62,7 @@ #include <private/qguiapplication_p.h> #include <private/qdnd_p.h> -#include <QtPlatformSupport/private/qshapedpixmapdndwindow_p.h> +#include <private/qshapedpixmapdndwindow_p.h> QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/dnd/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h similarity index 96% rename from src/platformsupport/dnd/qsimpledrag_p.h rename to src/gui/kernel/qsimpledrag_p.h index 10237b36d79..36ea4c1ec54 100644 --- a/src/platformsupport/dnd/qsimpledrag_p.h +++ b/src/gui/kernel/qsimpledrag_p.h @@ -56,7 +56,7 @@ class QEventLoop; class QDropData; class QShapedPixmapWindow; -class QBasicDrag : public QPlatformDrag, public QObject +class Q_GUI_EXPORT QBasicDrag : public QPlatformDrag, public QObject { public: virtual ~QBasicDrag(); @@ -99,7 +99,7 @@ private: QShapedPixmapWindow *m_drag_icon_window; }; -class QSimpleDrag : public QBasicDrag +class Q_GUI_EXPORT QSimpleDrag : public QBasicDrag { public: QSimpleDrag(); diff --git a/src/platformsupport/dnd/dnd.pri b/src/platformsupport/dnd/dnd.pri deleted file mode 100644 index 47feb81ef22..00000000000 --- a/src/platformsupport/dnd/dnd.pri +++ /dev/null @@ -1,6 +0,0 @@ -HEADERS += \ - $$PWD/qsimpledrag_p.h \ - $$PWD/qshapedpixmapdndwindow_p.h -SOURCES += \ - $$PWD/qsimpledrag.cpp \ - $$PWD/qshapedpixmapdndwindow.cpp diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro index 4cb1f2c1bfa..da87f395fd3 100644 --- a/src/platformsupport/platformsupport.pro +++ b/src/platformsupport/platformsupport.pro @@ -9,7 +9,6 @@ PRECOMPILED_HEADER = ../corelib/global/qt_pch.h include(cfsocketnotifier/cfsocketnotifier.pri) include(cglconvenience/cglconvenience.pri) -include(dnd/dnd.pri) include(eglconvenience/eglconvenience.pri) include(eventdispatchers/eventdispatchers.pri) include(fbconvenience/fbconvenience.pri) diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h index 6e29fd1a78e..80259df6006 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.h +++ b/src/plugins/platforms/cocoa/qcocoadrag.h @@ -45,7 +45,7 @@ #include <Cocoa/Cocoa.h> #include <QtGui> #include <qpa/qplatformdrag.h> -#include <QtPlatformSupport/private/qsimpledrag_p.h> +#include <private/qsimpledrag_p.h> #include <QtGui/private/qdnd_p.h> diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 072f60dff87..feb05e30934 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -89,7 +89,7 @@ #include <QtGui/QOpenGLContext> #endif -#include <QtPlatformSupport/private/qsimpledrag_p.h> +#include <private/qsimpledrag_p.h> #include <QtCore/QDebug> #include <QtCore/QHash> diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index db736cef4e7..4961e0377cc 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -57,8 +57,8 @@ #include <qpa/qwindowsysteminterface.h> -#include <QtPlatformSupport/private/qshapedpixmapdndwindow_p.h> -#include <QtPlatformSupport/private/qsimpledrag_p.h> +#include <private/qshapedpixmapdndwindow_p.h> +#include <private/qsimpledrag_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index 5678c2d3034..5648f70d9e8 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -43,7 +43,7 @@ #define QXCBDRAG_H #include <qpa/qplatformdrag.h> -#include <QtPlatformSupport/private/qsimpledrag_p.h> +#include <private/qsimpledrag_p.h> #include <qxcbobject.h> #include <xcb/xcb.h> #include <qlist.h> -- GitLab