Move QBasicDrag and QSimpleDrag to QtGui.

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>
This commit is contained in:
Samuel Rødal 2013-05-23 12:44:20 +02:00 committed by The Qt Project
parent 853a0b764e
commit 1df7a6a50a
12 changed files with 18 additions and 16 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -1,6 +0,0 @@
HEADERS += \
$$PWD/qsimpledrag_p.h \
$$PWD/qshapedpixmapdndwindow_p.h
SOURCES += \
$$PWD/qsimpledrag.cpp \
$$PWD/qshapedpixmapdndwindow.cpp

View File

@ -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)

View File

@ -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>

View File

@ -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>

View File

@ -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

View File

@ -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>