Make sure we can build with -no-feature-draganddrop

We move QInternalMimeData to a separate file, because this class is
used, even if draganddrop is disabled. From now on, include
qinternalmimedata_p.h instead of qdnd_p.h for QInternalMimeData.

Change-Id: I594e08e2e90d574dc445119091686b4b69e4731b
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This commit is contained in:
Joerg Bornemann 2018-04-13 09:01:43 +02:00
parent dd8e73504e
commit 9f27bfb31a
108 changed files with 653 additions and 541 deletions

View File

@ -62,7 +62,7 @@ class TorrentView : public QTreeWidget
public: public:
TorrentView(QWidget *parent = 0); TorrentView(QWidget *parent = 0);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
signals: signals:
void fileDropped(const QString &fileName); void fileDropped(const QString &fileName);
@ -702,12 +702,12 @@ void MainWindow::closeEvent(QCloseEvent *)
TorrentView::TorrentView(QWidget *parent) TorrentView::TorrentView(QWidget *parent)
: QTreeWidget(parent) : QTreeWidget(parent)
{ {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
setAcceptDrops(true); setAcceptDrops(true);
#endif #endif
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void TorrentView::dragMoveEvent(QDragMoveEvent *event) void TorrentView::dragMoveEvent(QDragMoveEvent *event)
{ {
// Accept file actions with a '.torrent' extension. // Accept file actions with a '.torrent' extension.

View File

@ -13,7 +13,7 @@ SUBDIRS = \
simpleanchorlayout \ simpleanchorlayout \
weatheranchorlayout weatheranchorlayout
contains(DEFINES, QT_NO_CURSOR)|contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= dragdroprobot contains(DEFINES, QT_NO_CURSOR)|!qtConfig(draganddrop): SUBDIRS -= dragdroprobot
qtHaveModule(opengl):!qtConfig(opengles.):!qtConfig(dynamicgl) { qtHaveModule(opengl):!qtConfig(opengles.):!qtConfig(dynamicgl) {
SUBDIRS += boxes SUBDIRS += boxes

View File

@ -20,5 +20,5 @@ SUBDIRS = addressbook \
spreadsheet \ spreadsheet \
stardelegate \ stardelegate \
storageview storageview
contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= puzzle !qtConfig(draganddrop): SUBDIRS -= puzzle
!qtHaveModule(xml): SUBDIRS -= simpledommodel !qtHaveModule(xml): SUBDIRS -= simpledommodel

View File

@ -26,5 +26,5 @@ qtHaveModule(gui):qtConfig(opengl): \
SUBDIRS += windowcontainer SUBDIRS += windowcontainer
contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows contains(DEFINES, QT_NO_CURSOR): SUBDIRS -= mainwindows
contains(DEFINES, QT_NO_DRAGANDDROP): SUBDIRS -= draganddrop !qtConfig(draganddrop): SUBDIRS -= draganddrop
mac:SUBDIRS += mac mac:SUBDIRS += mac

View File

@ -1414,7 +1414,7 @@ void QStandardItem::setTristate(bool tristate)
} }
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
Sets whether the item is drag enabled. If \a dragEnabled is true, the item Sets whether the item is drag enabled. If \a dragEnabled is true, the item
@ -1472,7 +1472,7 @@ void QStandardItem::setDropEnabled(bool dropEnabled)
\sa setDropEnabled(), isDragEnabled(), flags() \sa setDropEnabled(), isDragEnabled(), flags()
*/ */
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
Returns the row where the item is located in its parent's child table, or Returns the row where the item is located in its parent's child table, or

View File

@ -179,7 +179,7 @@ public:
QT_DEPRECATED void setTristate(bool tristate); QT_DEPRECATED void setTristate(bool tristate);
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
inline bool isDragEnabled() const { inline bool isDragEnabled() const {
return (flags() & Qt::ItemIsDragEnabled) != 0; return (flags() & Qt::ItemIsDragEnabled) != 0;
} }
@ -189,7 +189,7 @@ public:
return (flags() & Qt::ItemIsDropEnabled) != 0; return (flags() & Qt::ItemIsDropEnabled) != 0;
} }
void setDropEnabled(bool dropEnabled); void setDropEnabled(bool dropEnabled);
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
QStandardItem *parent() const; QStandardItem *parent() const;
int row() const; int row() const;

View File

@ -13,7 +13,6 @@ HEADERS += \
kernel/qwindowsysteminterface.h \ kernel/qwindowsysteminterface.h \
kernel/qwindowsysteminterface_p.h \ kernel/qwindowsysteminterface_p.h \
kernel/qplatformintegration.h \ kernel/qplatformintegration.h \
kernel/qplatformdrag.h \
kernel/qplatformscreen.h \ kernel/qplatformscreen.h \
kernel/qplatformscreen_p.h \ kernel/qplatformscreen_p.h \
kernel/qplatforminputcontext.h \ kernel/qplatforminputcontext.h \
@ -33,8 +32,6 @@ HEADERS += \
kernel/qplatformclipboard.h \ kernel/qplatformclipboard.h \
kernel/qplatformnativeinterface.h \ kernel/qplatformnativeinterface.h \
kernel/qplatformmenu.h \ kernel/qplatformmenu.h \
kernel/qshapedpixmapdndwindow_p.h \
kernel/qsimpledrag_p.h \
kernel/qsurfaceformat.h \ kernel/qsurfaceformat.h \
kernel/qguiapplication.h \ kernel/qguiapplication.h \
kernel/qguiapplication_p.h \ kernel/qguiapplication_p.h \
@ -46,12 +43,11 @@ HEADERS += \
kernel/qclipboard.h \ kernel/qclipboard.h \
kernel/qcursor.h \ kernel/qcursor.h \
kernel/qcursor_p.h \ kernel/qcursor_p.h \
kernel/qdrag.h \
kernel/qdnd_p.h \
kernel/qevent.h \ kernel/qevent.h \
kernel/qevent_p.h \ kernel/qevent_p.h \
kernel/qinputmethod.h \ kernel/qinputmethod.h \
kernel/qinputmethod_p.h \ kernel/qinputmethod_p.h \
kernel/qinternalmimedata_p.h \
kernel/qkeysequence.h \ kernel/qkeysequence.h \
kernel/qkeysequence_p.h \ kernel/qkeysequence_p.h \
kernel/qkeymapper_p.h \ kernel/qkeymapper_p.h \
@ -89,7 +85,6 @@ SOURCES += \
kernel/qplatforminputcontextplugin.cpp \ kernel/qplatforminputcontextplugin.cpp \
kernel/qplatforminputcontext.cpp \ kernel/qplatforminputcontext.cpp \
kernel/qplatformintegration.cpp \ kernel/qplatformintegration.cpp \
kernel/qplatformdrag.cpp \
kernel/qplatformscreen.cpp \ kernel/qplatformscreen.cpp \
kernel/qplatformintegrationfactory.cpp \ kernel/qplatformintegrationfactory.cpp \
kernel/qplatformintegrationplugin.cpp \ kernel/qplatformintegrationplugin.cpp \
@ -102,8 +97,6 @@ SOURCES += \
kernel/qplatformclipboard.cpp \ kernel/qplatformclipboard.cpp \
kernel/qplatformnativeinterface.cpp \ kernel/qplatformnativeinterface.cpp \
kernel/qsessionmanager.cpp \ kernel/qsessionmanager.cpp \
kernel/qshapedpixmapdndwindow.cpp \
kernel/qsimpledrag.cpp \
kernel/qsurfaceformat.cpp \ kernel/qsurfaceformat.cpp \
kernel/qguiapplication.cpp \ kernel/qguiapplication.cpp \
kernel/qwindow.cpp \ kernel/qwindow.cpp \
@ -112,10 +105,9 @@ SOURCES += \
kernel/qsurface.cpp \ kernel/qsurface.cpp \
kernel/qclipboard.cpp \ kernel/qclipboard.cpp \
kernel/qcursor.cpp \ kernel/qcursor.cpp \
kernel/qdrag.cpp \
kernel/qdnd.cpp \
kernel/qevent.cpp \ kernel/qevent.cpp \
kernel/qinputmethod.cpp \ kernel/qinputmethod.cpp \
kernel/qinternalmimedata.cpp \
kernel/qkeysequence.cpp \ kernel/qkeysequence.cpp \
kernel/qkeymapper.cpp \ kernel/qkeymapper.cpp \
kernel/qpalette.cpp \ kernel/qpalette.cpp \
@ -138,6 +130,21 @@ SOURCES += \
kernel/qinputdevicemanager.cpp \ kernel/qinputdevicemanager.cpp \
kernel/qhighdpiscaling.cpp kernel/qhighdpiscaling.cpp
qtConfig(draganddrop) {
HEADERS += \
kernel/qdnd_p.h \
kernel/qdrag.h \
kernel/qplatformdrag.h \
kernel/qshapedpixmapdndwindow_p.h \
kernel/qsimpledrag_p.h
SOURCES += \
kernel/qdnd.cpp \
kernel/qdrag.cpp \
kernel/qplatformdrag.cpp \
kernel/qshapedpixmapdndwindow.cpp \
kernel/qsimpledrag.cpp
}
qtConfig(opengl) { qtConfig(opengl) {
HEADERS += \ HEADERS += \

View File

@ -37,39 +37,19 @@
** **
****************************************************************************/ ****************************************************************************/
#include "qplatformdefs.h"
#include "qbitmap.h"
#include "qdrag.h"
#include "qpixmap.h"
#include "qevent.h"
#include "qfile.h"
#include "qtextcodec.h"
#include "qguiapplication.h"
#include "qpoint.h"
#include "qbuffer.h"
#include "qimage.h"
#include "qpainter.h"
#include "qregexp.h"
#include "qdir.h"
#include "qdnd_p.h" #include "qdnd_p.h"
#include "qimagereader.h"
#include "qimagewriter.h" #include "qguiapplication.h"
#include "qdebug.h"
#include <ctype.h> #include <ctype.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformdrag.h> #include <qpa/qplatformdrag.h>
#include <qpa/qplatformintegration.h>
#include <private/qguiapplication_p.h> #include <private/qguiapplication_p.h>
#ifndef QT_NO_DRAGANDDROP
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
// the universe's only drag manager // the universe's only drag manager
QDragManager *QDragManager::m_instance = 0; QDragManager *QDragManager::m_instance = 0;
QDragManager::QDragManager() QDragManager::QDragManager()
: QObject(qApp), m_currentDropTarget(0), : QObject(qApp), m_currentDropTarget(0),
m_platformDrag(QGuiApplicationPrivate::platformIntegration()->drag()), m_platformDrag(QGuiApplicationPrivate::platformIntegration()->drag()),
@ -78,7 +58,6 @@ QDragManager::QDragManager()
Q_ASSERT(!m_instance); Q_ASSERT(!m_instance);
} }
QDragManager::~QDragManager() QDragManager::~QDragManager()
{ {
m_instance = 0; m_instance = 0;
@ -142,196 +121,4 @@ Qt::DropAction QDragManager::drag(QDrag *o)
return result; return result;
} }
#endif // QT_NO_DRAGANDDROP
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
{
QStringList formats;
formats.reserve(imageFormats.size());
for (const auto &format : imageFormats)
formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
//put png at the front because it is best
int pngIndex = formats.indexOf(QLatin1String("image/png"));
if (pngIndex != -1 && pngIndex != 0)
formats.move(pngIndex, 0);
return formats;
}
static inline QStringList imageReadMimeFormats()
{
return imageMimeFormats(QImageReader::supportedImageFormats());
}
static inline QStringList imageWriteMimeFormats()
{
return imageMimeFormats(QImageWriter::supportedImageFormats());
}
QInternalMimeData::QInternalMimeData()
: QMimeData()
{
}
QInternalMimeData::~QInternalMimeData()
{
}
bool QInternalMimeData::hasFormat(const QString &mimeType) const
{
bool foundFormat = hasFormat_sys(mimeType);
if (!foundFormat && mimeType == QLatin1String("application/x-qt-image")) {
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if ((foundFormat = hasFormat_sys(imageFormats.at(i))))
break;
}
}
return foundFormat;
}
QStringList QInternalMimeData::formats() const
{
QStringList realFormats = formats_sys();
if (!realFormats.contains(QLatin1String("application/x-qt-image"))) {
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if (realFormats.contains(imageFormats.at(i))) {
realFormats += QLatin1String("application/x-qt-image");
break;
}
}
}
return realFormats;
}
QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const
{
QVariant data = retrieveData_sys(mimeType, type);
if (mimeType == QLatin1String("application/x-qt-image")) {
if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) {
// try to find an image
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
data = retrieveData_sys(imageFormats.at(i), type);
if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty()))
continue;
break;
}
}
// we wanted some image type, but all we got was a byte array. Convert it to an image.
if (data.type() == QVariant::ByteArray
&& (type == QVariant::Image || type == QVariant::Pixmap || type == QVariant::Bitmap))
data = QImage::fromData(data.toByteArray());
} else if (mimeType == QLatin1String("application/x-color") && data.type() == QVariant::ByteArray) {
QColor c;
QByteArray ba = data.toByteArray();
if (ba.size() == 8) {
ushort * colBuf = (ushort *)ba.data();
c.setRgbF(qreal(colBuf[0]) / qreal(0xFFFF),
qreal(colBuf[1]) / qreal(0xFFFF),
qreal(colBuf[2]) / qreal(0xFFFF),
qreal(colBuf[3]) / qreal(0xFFFF));
data = c;
} else {
qWarning("Qt: Invalid color format");
}
} else if (data.type() != type && data.type() == QVariant::ByteArray) {
// try to use mime data's internal conversion stuf.
QInternalMimeData *that = const_cast<QInternalMimeData *>(this);
that->setData(mimeType, data.toByteArray());
data = QMimeData::retrieveData(mimeType, type);
that->clear();
}
return data;
}
bool QInternalMimeData::canReadData(const QString &mimeType)
{
return imageReadMimeFormats().contains(mimeType);
}
// helper functions for rendering mimedata to the system, this is needed because QMimeData is in core.
QStringList QInternalMimeData::formatsHelper(const QMimeData *data)
{
QStringList realFormats = data->formats();
if (realFormats.contains(QLatin1String("application/x-qt-image"))) {
// add all supported image formats
QStringList imageFormats = imageWriteMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if (!realFormats.contains(imageFormats.at(i)))
realFormats.append(imageFormats.at(i));
}
}
return realFormats;
}
bool QInternalMimeData::hasFormatHelper(const QString &mimeType, const QMimeData *data)
{
bool foundFormat = data->hasFormat(mimeType);
if (!foundFormat) {
if (mimeType == QLatin1String("application/x-qt-image")) {
// check all supported image formats
QStringList imageFormats = imageWriteMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if ((foundFormat = data->hasFormat(imageFormats.at(i))))
break;
}
} else if (mimeType.startsWith(QLatin1String("image/"))) {
return data->hasImage() && imageWriteMimeFormats().contains(mimeType);
}
}
return foundFormat;
}
QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QMimeData *data)
{
QByteArray ba;
if (mimeType == QLatin1String("application/x-color")) {
/* QMimeData can only provide colors as QColor or the name
of a color as a QByteArray or a QString. So we need to do
the conversion to application/x-color here.
The application/x-color format is :
type: application/x-color
format: 16
data[0]: red
data[1]: green
data[2]: blue
data[3]: opacity
*/
ba.resize(8);
ushort * colBuf = (ushort *)ba.data();
QColor c = qvariant_cast<QColor>(data->colorData());
colBuf[0] = ushort(c.redF() * 0xFFFF);
colBuf[1] = ushort(c.greenF() * 0xFFFF);
colBuf[2] = ushort(c.blueF() * 0xFFFF);
colBuf[3] = ushort(c.alphaF() * 0xFFFF);
} else {
ba = data->data(mimeType);
if (ba.isEmpty()) {
if (mimeType == QLatin1String("application/x-qt-image") && data->hasImage()) {
QImage image = qvariant_cast<QImage>(data->imageData());
QBuffer buf(&ba);
buf.open(QBuffer::WriteOnly);
// would there not be PNG ??
image.save(&buf, "PNG");
} else if (mimeType.startsWith(QLatin1String("image/")) && data->hasImage()) {
QImage image = qvariant_cast<QImage>(data->imageData());
QBuffer buf(&ba);
buf.open(QBuffer::WriteOnly);
image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper());
}
}
}
return ba;
}
#endif // QT_NO_DRAGANDDROP && QT_NO_CLIPBOARD
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -62,42 +62,17 @@
#include "QtCore/qpoint.h" #include "QtCore/qpoint.h"
#include "private/qobject_p.h" #include "private/qobject_p.h"
#include "QtGui/qbackingstore.h" #include "QtGui/qbackingstore.h"
// ### Remove the following include, once everybody includes
// qinternalmimedata_p.h for QInternalMimeData.
#include "qinternalmimedata_p.h"
QT_REQUIRE_CONFIG(draganddrop);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QEventLoop;
class QMouseEvent;
class QPlatformDrag; class QPlatformDrag;
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
class Q_GUI_EXPORT QInternalMimeData : public QMimeData
{
Q_OBJECT
public:
QInternalMimeData();
~QInternalMimeData();
bool hasFormat(const QString &mimeType) const override;
QStringList formats() const override;
static bool canReadData(const QString &mimeType);
static QStringList formatsHelper(const QMimeData *data);
static bool hasFormatHelper(const QString &mimeType, const QMimeData *data);
static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data);
protected:
QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
virtual bool hasFormat_sys(const QString &mimeType) const = 0;
virtual QStringList formats_sys() const = 0;
virtual QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const = 0;
};
#endif // !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
#ifndef QT_NO_DRAGANDDROP
class QDragPrivate : public QObjectPrivate class QDragPrivate : public QObjectPrivate
{ {
public: public:
@ -142,10 +117,6 @@ private:
Q_DISABLE_COPY(QDragManager) Q_DISABLE_COPY(QDragManager)
}; };
#endif // !QT_NO_DRAGANDDROP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QDND_P_H #endif // QDND_P_H

View File

@ -45,8 +45,6 @@
#include <qpoint.h> #include <qpoint.h>
#include "qdnd_p.h" #include "qdnd_p.h"
#ifndef QT_NO_DRAGANDDROP
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/*! /*!
@ -420,5 +418,3 @@ void QDrag::cancel()
*/ */
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QT_NO_DRAGANDDROP

View File

@ -43,10 +43,10 @@
#include <QtGui/qtguiglobal.h> #include <QtGui/qtguiglobal.h>
#include <QtCore/qobject.h> #include <QtCore/qobject.h>
QT_REQUIRE_CONFIG(draganddrop);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_DRAGANDDROP
class QMimeData; class QMimeData;
class QDragPrivate; class QDragPrivate;
class QPixmap; class QPixmap;
@ -95,8 +95,6 @@ private:
Q_DISABLE_COPY(QDrag) Q_DISABLE_COPY(QDrag)
}; };
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QDRAG_H #endif // QDRAG_H

View File

@ -42,16 +42,19 @@
#include "private/qguiapplication_p.h" #include "private/qguiapplication_p.h"
#include "private/qtouchdevice_p.h" #include "private/qtouchdevice_p.h"
#include "qpa/qplatformintegration.h" #include "qpa/qplatformintegration.h"
#include "qpa/qplatformdrag.h"
#include "private/qevent_p.h" #include "private/qevent_p.h"
#include "qfile.h" #include "qfile.h"
#include "qhashfunctions.h" #include "qhashfunctions.h"
#include "qmetaobject.h" #include "qmetaobject.h"
#include "qmimedata.h" #include "qmimedata.h"
#include "private/qdnd_p.h"
#include "qevent_p.h" #include "qevent_p.h"
#include "qmath.h" #include "qmath.h"
#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h>
#include <private/qdnd_p.h>
#endif
#include <private/qdebug_p.h> #include <private/qdebug_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -2883,7 +2886,7 @@ const QTouchDevice *QNativeGestureEvent::device() const
*/ */
#endif // QT_NO_GESTURES #endif // QT_NO_GESTURES
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
Creates a QDragMoveEvent of the required \a type indicating Creates a QDragMoveEvent of the required \a type indicating
that the mouse is at position \a pos given within a widget. that the mouse is at position \a pos given within a widget.
@ -3227,7 +3230,7 @@ QDragLeaveEvent::QDragLeaveEvent()
QDragLeaveEvent::~QDragLeaveEvent() QDragLeaveEvent::~QDragLeaveEvent()
{ {
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
\class QHelpEvent \class QHelpEvent
@ -3902,7 +3905,7 @@ static const char *eventClassName(QEvent::Type t)
return "QEvent"; return "QEvent";
} }
# ifndef QT_NO_DRAGANDDROP # if QT_CONFIG(draganddrop)
static void formatDropEvent(QDebug d, const QDropEvent *e) static void formatDropEvent(QDebug d, const QDropEvent *e)
{ {
@ -3923,7 +3926,7 @@ static void formatDropEvent(QDebug d, const QDropEvent *e)
QtDebugUtils::formatQFlags(d, e->mouseButtons()); QtDebugUtils::formatQFlags(d, e->mouseButtons());
} }
# endif // !QT_NO_DRAGANDDROP # endif // QT_CONFIG(draganddrop)
# if QT_CONFIG(tabletevent) # if QT_CONFIG(tabletevent)
@ -4086,13 +4089,13 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
dbg << ')'; dbg << ')';
} }
break; break;
# ifndef QT_NO_DRAGANDDROP # if QT_CONFIG(draganddrop)
case QEvent::DragEnter: case QEvent::DragEnter:
case QEvent::DragMove: case QEvent::DragMove:
case QEvent::Drop: case QEvent::Drop:
formatDropEvent(dbg, static_cast<const QDropEvent *>(e)); formatDropEvent(dbg, static_cast<const QDropEvent *>(e));
break; break;
# endif // !QT_NO_DRAGANDDROP # endif // QT_CONFIG(draganddrop)
case QEvent::InputMethod: case QEvent::InputMethod:
formatInputMethodEvent(dbg, static_cast<const QInputMethodEvent *>(e)); formatInputMethodEvent(dbg, static_cast<const QInputMethodEvent *>(e));
break; break;

View File

@ -598,7 +598,7 @@ Q_DECLARE_TYPEINFO(QInputMethodQueryEvent::QueryPair, Q_MOVABLE_TYPE);
#endif // QT_NO_INPUTMETHOD #endif // QT_NO_INPUTMETHOD
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
class QMimeData; class QMimeData;
@ -671,7 +671,7 @@ public:
QDragLeaveEvent(); QDragLeaveEvent();
~QDragLeaveEvent(); ~QDragLeaveEvent();
}; };
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
class Q_GUI_EXPORT QHelpEvent : public QEvent class Q_GUI_EXPORT QHelpEvent : public QEvent

View File

@ -50,7 +50,6 @@
#include <qpa/qplatformnativeinterface.h> #include <qpa/qplatformnativeinterface.h>
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
#include <qpa/qplatformdrag.h>
#include <QtCore/QAbstractEventDispatcher> #include <QtCore/QAbstractEventDispatcher>
#include <QtCore/QStandardPaths> #include <QtCore/QStandardPaths>
@ -87,9 +86,13 @@
#include "private/qinputdevicemanager_p.h" #include "private/qinputdevicemanager_p.h"
#include "private/qtouchdevice_p.h" #include "private/qtouchdevice_p.h"
#include "private/qdnd_p.h"
#include <qpa/qplatformthemefactory_p.h> #include <qpa/qplatformthemefactory_p.h>
#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h>
#include <private/qdnd_p.h>
#endif
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
#include <qpa/qplatformcursor.h> #include <qpa/qplatformcursor.h>
#endif #endif
@ -3034,7 +3037,7 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
QCoreApplication::sendSpontaneousEvent(window, &exposeEvent); QCoreApplication::sendSpontaneousEvent(window, &exposeEvent);
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPlatformDragQtResponse QGuiApplicationPrivate::processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions) QPlatformDragQtResponse QGuiApplicationPrivate::processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{ {
@ -3094,7 +3097,7 @@ QPlatformDropQtResponse QGuiApplicationPrivate::processDrop(QWindow *w, const QM
return response; return response;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
/*! /*!
@ -3910,7 +3913,7 @@ void QGuiApplicationPrivate::notifyThemeChanged()
} }
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag) void QGuiApplicationPrivate::notifyDragStarted(const QDrag *drag)
{ {
Q_UNUSED(drag) Q_UNUSED(drag)

View File

@ -70,9 +70,9 @@ class QColorProfile;
class QPlatformIntegration; class QPlatformIntegration;
class QPlatformTheme; class QPlatformTheme;
class QPlatformDragQtResponse; class QPlatformDragQtResponse;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
class QDrag; class QDrag;
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
class QInputDeviceManager; class QInputDeviceManager;
class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate class Q_GUI_EXPORT QGuiApplicationPrivate : public QCoreApplicationPrivate
@ -162,7 +162,7 @@ public:
static void processContextMenuEvent(QWindowSystemInterfacePrivate::ContextMenuEvent *e); static void processContextMenuEvent(QWindowSystemInterfacePrivate::ContextMenuEvent *e);
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
static QPlatformDragQtResponse processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); static QPlatformDragQtResponse processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
static QPlatformDropQtResponse processDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); static QPlatformDropQtResponse processDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
#endif #endif
@ -309,9 +309,9 @@ public:
protected: protected:
virtual void notifyThemeChanged(); virtual void notifyThemeChanged();
bool tryCloseRemainingWindows(QWindowList processedWindows); bool tryCloseRemainingWindows(QWindowList processedWindows);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual void notifyDragStarted(const QDrag *); virtual void notifyDragStarted(const QDrag *);
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
private: private:
friend class QDragManager; friend class QDragManager;

View File

@ -0,0 +1,234 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qinternalmimedata_p.h"
#include <QtCore/qbuffer.h>
#include <QtGui/qimage.h>
#include <QtGui/qimagereader.h>
#include <QtGui/qimagewriter.h>
QT_BEGIN_NAMESPACE
static QStringList imageMimeFormats(const QList<QByteArray> &imageFormats)
{
QStringList formats;
formats.reserve(imageFormats.size());
for (const auto &format : imageFormats)
formats.append(QLatin1String("image/") + QLatin1String(format.toLower()));
//put png at the front because it is best
int pngIndex = formats.indexOf(QLatin1String("image/png"));
if (pngIndex != -1 && pngIndex != 0)
formats.move(pngIndex, 0);
return formats;
}
static inline QStringList imageReadMimeFormats()
{
return imageMimeFormats(QImageReader::supportedImageFormats());
}
static inline QStringList imageWriteMimeFormats()
{
return imageMimeFormats(QImageWriter::supportedImageFormats());
}
QInternalMimeData::QInternalMimeData()
: QMimeData()
{
}
QInternalMimeData::~QInternalMimeData()
{
}
bool QInternalMimeData::hasFormat(const QString &mimeType) const
{
bool foundFormat = hasFormat_sys(mimeType);
if (!foundFormat && mimeType == QLatin1String("application/x-qt-image")) {
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if ((foundFormat = hasFormat_sys(imageFormats.at(i))))
break;
}
}
return foundFormat;
}
QStringList QInternalMimeData::formats() const
{
QStringList realFormats = formats_sys();
if (!realFormats.contains(QLatin1String("application/x-qt-image"))) {
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if (realFormats.contains(imageFormats.at(i))) {
realFormats += QLatin1String("application/x-qt-image");
break;
}
}
}
return realFormats;
}
QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const
{
QVariant data = retrieveData_sys(mimeType, type);
if (mimeType == QLatin1String("application/x-qt-image")) {
if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) {
// try to find an image
QStringList imageFormats = imageReadMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
data = retrieveData_sys(imageFormats.at(i), type);
if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty()))
continue;
break;
}
}
// we wanted some image type, but all we got was a byte array. Convert it to an image.
if (data.type() == QVariant::ByteArray
&& (type == QVariant::Image || type == QVariant::Pixmap || type == QVariant::Bitmap))
data = QImage::fromData(data.toByteArray());
} else if (mimeType == QLatin1String("application/x-color") && data.type() == QVariant::ByteArray) {
QColor c;
QByteArray ba = data.toByteArray();
if (ba.size() == 8) {
ushort * colBuf = (ushort *)ba.data();
c.setRgbF(qreal(colBuf[0]) / qreal(0xFFFF),
qreal(colBuf[1]) / qreal(0xFFFF),
qreal(colBuf[2]) / qreal(0xFFFF),
qreal(colBuf[3]) / qreal(0xFFFF));
data = c;
} else {
qWarning("Qt: Invalid color format");
}
} else if (data.type() != type && data.type() == QVariant::ByteArray) {
// try to use mime data's internal conversion stuf.
QInternalMimeData *that = const_cast<QInternalMimeData *>(this);
that->setData(mimeType, data.toByteArray());
data = QMimeData::retrieveData(mimeType, type);
that->clear();
}
return data;
}
bool QInternalMimeData::canReadData(const QString &mimeType)
{
return imageReadMimeFormats().contains(mimeType);
}
// helper functions for rendering mimedata to the system, this is needed because QMimeData is in core.
QStringList QInternalMimeData::formatsHelper(const QMimeData *data)
{
QStringList realFormats = data->formats();
if (realFormats.contains(QLatin1String("application/x-qt-image"))) {
// add all supported image formats
QStringList imageFormats = imageWriteMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if (!realFormats.contains(imageFormats.at(i)))
realFormats.append(imageFormats.at(i));
}
}
return realFormats;
}
bool QInternalMimeData::hasFormatHelper(const QString &mimeType, const QMimeData *data)
{
bool foundFormat = data->hasFormat(mimeType);
if (!foundFormat) {
if (mimeType == QLatin1String("application/x-qt-image")) {
// check all supported image formats
QStringList imageFormats = imageWriteMimeFormats();
for (int i = 0; i < imageFormats.size(); ++i) {
if ((foundFormat = data->hasFormat(imageFormats.at(i))))
break;
}
} else if (mimeType.startsWith(QLatin1String("image/"))) {
return data->hasImage() && imageWriteMimeFormats().contains(mimeType);
}
}
return foundFormat;
}
QByteArray QInternalMimeData::renderDataHelper(const QString &mimeType, const QMimeData *data)
{
QByteArray ba;
if (mimeType == QLatin1String("application/x-color")) {
/* QMimeData can only provide colors as QColor or the name
of a color as a QByteArray or a QString. So we need to do
the conversion to application/x-color here.
The application/x-color format is :
type: application/x-color
format: 16
data[0]: red
data[1]: green
data[2]: blue
data[3]: opacity
*/
ba.resize(8);
ushort * colBuf = (ushort *)ba.data();
QColor c = qvariant_cast<QColor>(data->colorData());
colBuf[0] = ushort(c.redF() * 0xFFFF);
colBuf[1] = ushort(c.greenF() * 0xFFFF);
colBuf[2] = ushort(c.blueF() * 0xFFFF);
colBuf[3] = ushort(c.alphaF() * 0xFFFF);
} else {
ba = data->data(mimeType);
if (ba.isEmpty()) {
if (mimeType == QLatin1String("application/x-qt-image") && data->hasImage()) {
QImage image = qvariant_cast<QImage>(data->imageData());
QBuffer buf(&ba);
buf.open(QBuffer::WriteOnly);
// would there not be PNG ??
image.save(&buf, "PNG");
} else if (mimeType.startsWith(QLatin1String("image/")) && data->hasImage()) {
QImage image = qvariant_cast<QImage>(data->imageData());
QBuffer buf(&ba);
buf.open(QBuffer::WriteOnly);
image.save(&buf, mimeType.mid(mimeType.indexOf(QLatin1Char('/')) + 1).toLatin1().toUpper());
}
}
}
return ba;
}
QT_END_NAMESPACE

View File

@ -0,0 +1,93 @@
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QINTERNALMIMEDATA_P_H
#define QINTERNALMIMEDATA_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <QtCore/qbytearray.h>
#include <QtCore/qmimedata.h>
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qvariant.h>
#include <QtGui/private/qtguiglobal_p.h>
QT_BEGIN_NAMESPACE
class QEventLoop;
class QMouseEvent;
class QPlatformDrag;
class Q_GUI_EXPORT QInternalMimeData : public QMimeData
{
Q_OBJECT
public:
QInternalMimeData();
~QInternalMimeData();
bool hasFormat(const QString &mimeType) const override;
QStringList formats() const override;
static bool canReadData(const QString &mimeType);
static QStringList formatsHelper(const QMimeData *data);
static bool hasFormatHelper(const QString &mimeType, const QMimeData *data);
static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data);
protected:
QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
virtual bool hasFormat_sys(const QString &mimeType) const = 0;
virtual QStringList formats_sys() const = 0;
virtual QVariant retrieveData_sys(const QString &mimeType, QVariant::Type type) const = 0;
};
QT_END_NAMESPACE
#endif // QINTERNALMIMEDATA_P_H

View File

@ -46,7 +46,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_DRAGANDDROP
#ifdef QDND_DEBUG #ifdef QDND_DEBUG
# include <QtCore/QDebug> # include <QtCore/QDebug>
#endif #endif
@ -222,6 +221,4 @@ bool QPlatformDrag::ownsDragObject() const
return false; return false;
} }
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -52,9 +52,9 @@
#include <QtGui/qtguiglobal.h> #include <QtGui/qtguiglobal.h>
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(draganddrop);
#ifndef QT_NO_DRAGANDDROP QT_BEGIN_NAMESPACE
class QMimeData; class QMimeData;
class QMouseEvent; class QMouseEvent;
@ -112,8 +112,6 @@ private:
Q_DISABLE_COPY(QPlatformDrag) Q_DISABLE_COPY(QPlatformDrag)
}; };
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif

View File

@ -45,8 +45,11 @@
#include <qpa/qplatformtheme.h> #include <qpa/qplatformtheme.h>
#include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qpixmap_raster_p.h> #include <QtGui/private/qpixmap_raster_p.h>
#if QT_CONFIG(draganddrop)
#include <private/qdnd_p.h> #include <private/qdnd_p.h>
#include <private/qsimpledrag_p.h> #include <private/qsimpledrag_p.h>
#endif
#ifndef QT_NO_SESSIONMANAGER #ifndef QT_NO_SESSIONMANAGER
# include <qpa/qplatformsessionmanager.h> # include <qpa/qplatformsessionmanager.h>
@ -92,7 +95,7 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
Accessor for the platform integration's drag object. Accessor for the platform integration's drag object.
@ -107,7 +110,7 @@ QPlatformDrag *QPlatformIntegration::drag() const
} }
return drag; return drag;
} }
#endif #endif // QT_CONFIG(draganddrop)
QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const
{ {

View File

@ -130,7 +130,7 @@ public:
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
virtual QPlatformClipboard *clipboard() const; virtual QPlatformClipboard *clipboard() const;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual QPlatformDrag *drag() const; virtual QPlatformDrag *drag() const;
#endif #endif
virtual QPlatformInputContext *inputContext() const; virtual QPlatformInputContext *inputContext() const;

View File

@ -55,6 +55,8 @@
#include <QtGui/QRasterWindow> #include <QtGui/QRasterWindow>
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
QT_REQUIRE_CONFIG(draganddrop);
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QShapedPixmapWindow : public QRasterWindow class QShapedPixmapWindow : public QRasterWindow

View File

@ -68,8 +68,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_DRAGANDDROP
Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd") Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd")
static QWindow* topLevelAt(const QPoint &pos) static QWindow* topLevelAt(const QPoint &pos)
@ -434,6 +432,4 @@ void QSimpleDrag::drop(const QPoint &nativeGlobalPos)
} }
} }
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -56,9 +56,9 @@
#include <QtCore/QObject> #include <QtCore/QObject>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(draganddrop);
#ifndef QT_NO_DRAGANDDROP QT_BEGIN_NAMESPACE
class QMouseEvent; class QMouseEvent;
class QWindow; class QWindow;
@ -136,8 +136,6 @@ protected:
virtual void drop(const QPoint &globalPos) override; virtual void drop(const QPoint &globalPos) override;
}; };
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif

View File

@ -55,7 +55,9 @@
# include "qaccessible.h" # include "qaccessible.h"
#endif #endif
#include "qhighdpiscaling_p.h" #include "qhighdpiscaling_p.h"
#if QT_CONFIG(draganddrop)
#include "qshapedpixmapdndwindow_p.h" #include "qshapedpixmapdndwindow_p.h"
#endif // QT_CONFIG(draganddrop)
#include <private/qevent_p.h> #include <private/qevent_p.h>
@ -382,7 +384,11 @@ void QWindowPrivate::setVisible(bool visible)
QGuiApplicationPrivate::hideModalWindow(q); QGuiApplicationPrivate::hideModalWindow(q);
// QShapedPixmapWindow is used on some platforms for showing a drag pixmap, so don't block // QShapedPixmapWindow is used on some platforms for showing a drag pixmap, so don't block
// input to this window as it is performing a drag - QTBUG-63846 // input to this window as it is performing a drag - QTBUG-63846
} else if (visible && QGuiApplication::modalWindow() && !qobject_cast<QShapedPixmapWindow *>(q)) { } else if (visible && QGuiApplication::modalWindow()
#if QT_CONFIG(draganddrop)
&& !qobject_cast<QShapedPixmapWindow *>(q)
#endif // QT_CONFIG(draganddrop)
) {
QGuiApplicationPrivate::updateBlockedStatus(q); QGuiApplicationPrivate::updateBlockedStatus(q);
} }

View File

@ -43,12 +43,15 @@
#include "private/qevent_p.h" #include "private/qevent_p.h"
#include "private/qtouchdevice_p.h" #include "private/qtouchdevice_p.h"
#include <QAbstractEventDispatcher> #include <QAbstractEventDispatcher>
#include <qpa/qplatformdrag.h>
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
#include <qdebug.h> #include <qdebug.h>
#include "qhighdpiscaling_p.h" #include "qhighdpiscaling_p.h"
#include <QtCore/qscopedvaluerollback.h> #include <QtCore/qscopedvaluerollback.h>
#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -791,7 +794,7 @@ void QWindowSystemInterface::handleThemeChange(QWindow *window)
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e); QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *window, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions) QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *window, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{ {
return QGuiApplicationPrivate::processDrag(window, dropData, QHighDpi::fromNativeLocalPosition(p, window) ,supportedActions); return QGuiApplicationPrivate::processDrag(window, dropData, QHighDpi::fromNativeLocalPosition(p, window) ,supportedActions);
@ -801,7 +804,7 @@ QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *window, cons
{ {
return QGuiApplicationPrivate::processDrop(window, dropData, QHighDpi::fromNativeLocalPosition(p, window),supportedActions); return QGuiApplicationPrivate::processDrop(window, dropData, QHighDpi::fromNativeLocalPosition(p, window),supportedActions);
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
\fn static QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result) \fn static QWindowSystemInterface::handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result)

View File

@ -214,7 +214,7 @@ public:
template<typename Delivery = QWindowSystemInterface::DefaultDelivery> template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false); static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
// Drag and drop. These events are sent immediately. // Drag and drop. These events are sent immediately.
static QPlatformDragQtResponse handleDrag(QWindow *window, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); static QPlatformDragQtResponse handleDrag(QWindow *window, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
static QPlatformDropQtResponse handleDrop(QWindow *window, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions); static QPlatformDropQtResponse handleDrop(QWindow *window, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);

View File

@ -46,6 +46,7 @@
#include <private/qsimpledrag_p.h> #include <private/qsimpledrag_p.h>
#include <QtGui/private/qdnd_p.h> #include <QtGui/private/qdnd_p.h>
#include <QtGui/private/qinternalmimedata_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -41,7 +41,9 @@
#define QOFFSCREENCOMMON_H #define QOFFSCREENCOMMON_H
#include <qpa/qplatformbackingstore.h> #include <qpa/qplatformbackingstore.h>
#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h> #include <qpa/qplatformdrag.h>
#endif
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
#include <qpa/qplatformscreen.h> #include <qpa/qplatformscreen.h>
#include <qpa/qplatformwindow.h> #include <qpa/qplatformwindow.h>
@ -71,7 +73,7 @@ public:
QScopedPointer<QPlatformCursor> m_cursor; QScopedPointer<QPlatformCursor> m_cursor;
}; };
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
class QOffscreenDrag : public QPlatformDrag class QOffscreenDrag : public QPlatformDrag
{ {
public: public:

View File

@ -109,7 +109,7 @@ QOffscreenIntegration::QOffscreenIntegration()
m_fontDatabase.reset(new QFreeTypeFontDatabase()); m_fontDatabase.reset(new QFreeTypeFontDatabase());
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
m_drag.reset(new QOffscreenDrag); m_drag.reset(new QOffscreenDrag);
#endif #endif
m_services.reset(new QPlatformServices); m_services.reset(new QPlatformServices);
@ -204,7 +204,7 @@ QPlatformFontDatabase *QOffscreenIntegration::fontDatabase() const
return m_fontDatabase.data(); return m_fontDatabase.data();
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPlatformDrag *QOffscreenIntegration::drag() const QPlatformDrag *QOffscreenIntegration::drag() const
{ {
return m_drag.data(); return m_drag.data();

View File

@ -59,7 +59,7 @@ public:
QPlatformWindow *createPlatformWindow(QWindow *window) const override; QPlatformWindow *createPlatformWindow(QWindow *window) const override;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPlatformDrag *drag() const override; QPlatformDrag *drag() const override;
#endif #endif
@ -76,7 +76,7 @@ public:
private: private:
QScopedPointer<QPlatformFontDatabase> m_fontDatabase; QScopedPointer<QPlatformFontDatabase> m_fontDatabase;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QScopedPointer<QPlatformDrag> m_drag; QScopedPointer<QPlatformDrag> m_drag;
#endif #endif
QScopedPointer<QPlatformInputContext> m_inputContext; QScopedPointer<QPlatformInputContext> m_inputContext;

View File

@ -139,7 +139,7 @@ QQnxIntegration::QQnxIntegration(const QStringList &paramList)
, m_clipboard(0) , m_clipboard(0)
#endif #endif
, m_navigator(0) , m_navigator(0)
#if !defined(QT_NO_DRAGANDDROP) #if QT_CONFIG(draganddrop)
, m_drag(new QSimpleDrag()) , m_drag(new QSimpleDrag())
#endif #endif
{ {
@ -212,7 +212,7 @@ QQnxIntegration::~QQnxIntegration()
qIntegrationDebug("platform plugin shutdown begin"); qIntegrationDebug("platform plugin shutdown begin");
delete m_nativeInterface; delete m_nativeInterface;
#if !defined(QT_NO_DRAGANDDROP) #if QT_CONFIG(draganddrop)
// Destroy the drag object // Destroy the drag object
delete m_drag; delete m_drag;
#endif #endif
@ -419,7 +419,7 @@ QPlatformClipboard *QQnxIntegration::clipboard() const
} }
#endif #endif
#if !defined(QT_NO_DRAGANDDROP) #if QT_CONFIG(draganddrop)
QPlatformDrag *QQnxIntegration::drag() const QPlatformDrag *QQnxIntegration::drag() const
{ {
return m_drag; return m_drag;

View File

@ -113,7 +113,7 @@ public:
#if !defined(QT_NO_CLIPBOARD) #if !defined(QT_NO_CLIPBOARD)
QPlatformClipboard *clipboard() const override; QPlatformClipboard *clipboard() const override;
#endif #endif
#if !defined(QT_NO_DRAGANDDROP) #if QT_CONFIG(draganddrop)
QPlatformDrag *drag() const override; QPlatformDrag *drag() const override;
#endif #endif
QVariant styleHint(StyleHint hint) const override; QVariant styleHint(StyleHint hint) const override;
@ -158,7 +158,7 @@ private:
mutable QQnxClipboard* m_clipboard; mutable QQnxClipboard* m_clipboard;
#endif #endif
QQnxAbstractNavigator *m_navigator; QQnxAbstractNavigator *m_navigator;
#if !defined(QT_NO_DRAGANDDROP) #if QT_CONFIG(draganddrop)
QSimpleDrag *m_drag; QSimpleDrag *m_drag;
#endif #endif
static QQnxWindowMapper ms_windowMapper; static QQnxWindowMapper ms_windowMapper;

View File

@ -56,6 +56,7 @@
#include <QtGui/QRasterWindow> #include <QtGui/QRasterWindow>
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <qpa/qwindowsysteminterface_p.h> #include <qpa/qwindowsysteminterface_p.h>
#include <QtGui/private/qdnd_p.h>
#include <QtGui/private/qguiapplication_p.h> #include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qhighdpiscaling_p.h> #include <QtGui/private/qhighdpiscaling_p.h>

View File

@ -44,6 +44,7 @@
#include "qwindowsinternalmimedata.h" #include "qwindowsinternalmimedata.h"
#include <qpa/qplatformdrag.h> #include <qpa/qplatformdrag.h>
#include <QtGui/qdrag.h>
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
struct IDropTargetHelper; struct IDropTargetHelper;

View File

@ -552,7 +552,7 @@ QPlatformDrag *QWindowsIntegration::drag() const
{ {
return &d->m_drag; return &d->m_drag;
} }
# endif // !QT_NO_DRAGANDDROP # endif // QT_CONFIG(draganddrop)
#endif // !QT_NO_CLIPBOARD #endif // !QT_NO_CLIPBOARD
QPlatformInputContext * QWindowsIntegration::inputContext() const QPlatformInputContext * QWindowsIntegration::inputContext() const

View File

@ -42,7 +42,7 @@
#include <QtCore/qt_windows.h> #include <QtCore/qt_windows.h>
#include <QtGui/private/qdnd_p.h> // QInternalMime #include <QtGui/private/qinternalmimedata_p.h>
#include <QtCore/QVariant> #include <QtCore/QVariant>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -40,7 +40,7 @@
#include "qwindowsmime.h" #include "qwindowsmime.h"
#include "qwindowscontext.h" #include "qwindowscontext.h"
#include <QtGui/private/qdnd_p.h> #include <QtGui/private/qinternalmimedata_p.h>
#include <QtCore/QByteArrayMatcher> #include <QtCore/QByteArrayMatcher>
#include <QtCore/QTextCodec> #include <QtCore/QTextCodec>
#include <QtCore/QMap> #include <QtCore/QMap>
@ -1255,7 +1255,7 @@ bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData
} else { } else {
#if QT_CONFIG(draganddrop) #if QT_CONFIG(draganddrop)
data = QInternalMimeData::renderDataHelper(outFormats.value(getCf(formatetc)), mimeData); data = QInternalMimeData::renderDataHelper(outFormats.value(getCf(formatetc)), mimeData);
#endif //QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
} }
return setData(data, pmedium); return setData(data, pmedium);
} }
@ -1363,7 +1363,7 @@ bool QLastResortMimes::canConvertFromMime(const FORMATETC &formatetc, const QMim
Q_UNUSED(formatetc); Q_UNUSED(formatetc);
return formatetc.tymed & TYMED_HGLOBAL return formatetc.tymed & TYMED_HGLOBAL
&& formats.contains(formatetc.cfFormat); && formats.contains(formatetc.cfFormat);
#endif //QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
} }
bool QLastResortMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const bool QLastResortMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const
@ -1376,7 +1376,7 @@ bool QLastResortMimes::convertFromMime(const FORMATETC &formatetc, const QMimeDa
Q_UNUSED(formatetc); Q_UNUSED(formatetc);
Q_UNUSED(pmedium); Q_UNUSED(pmedium);
return false; return false;
#endif //QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
} }
QVector<FORMATETC> QLastResortMimes::formatsForMime(const QString &mimeType, const QMimeData * /*mimeData*/) const QVector<FORMATETC> QLastResortMimes::formatsForMime(const QString &mimeType, const QMimeData * /*mimeData*/) const
@ -1484,7 +1484,7 @@ QString QLastResortMimes::mimeForFormat(const FORMATETC &formatetc) const
format = clipFormat; format = clipFormat;
} }
} }
#endif //QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
} }
return format; return format;
@ -1559,7 +1559,7 @@ QVector<FORMATETC> QWindowsMimeConverter::allFormatsForMime(const QMimeData *mim
{ {
ensureInitialized(); ensureInitialized();
QVector<FORMATETC> formatics; QVector<FORMATETC> formatics;
#ifdef QT_NO_DRAGANDDROP #if !QT_CONFIG(draganddrop)
Q_UNUSED(mimeData); Q_UNUSED(mimeData);
#else #else
formatics.reserve(20); formatics.reserve(20);
@ -1568,7 +1568,7 @@ QVector<FORMATETC> QWindowsMimeConverter::allFormatsForMime(const QMimeData *mim
for (int i = m_mimes.size() - 1; i >= 0; --i) for (int i = m_mimes.size() - 1; i >= 0; --i)
formatics += m_mimes.at(i)->formatsForMime(formats.at(f), mimeData); formatics += m_mimes.at(i)->formatsForMime(formats.at(f), mimeData);
} }
#endif //QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
return formatics; return formatics;
} }

View File

@ -1248,7 +1248,7 @@ void QWindowsWindow::setDropSiteEnabled(bool dropEnabled)
RevokeDragDrop(m_data.hwnd); RevokeDragDrop(m_data.hwnd);
m_dropTarget = 0; m_dropTarget = 0;
} }
#endif // !QT_NO_CLIPBOARD && !QT_NO_DRAGANDDROP #endif // QT_CONFIG(clipboard) && QT_CONFIG(draganddrop)
} }
// Returns topmost QWindowsWindow ancestor even if there are embedded windows in the chain. // Returns topmost QWindowsWindow ancestor even if there are embedded windows in the chain.

View File

@ -41,7 +41,8 @@
#include <QtCore/QLoggingCategory> #include <QtCore/QLoggingCategory>
#include <QtCore/QMimeData> #include <QtCore/QMimeData>
#include <QtGui/private/qdnd_p.h> // QInternalMime #include <QtGui/private/qdnd_p.h>
#include <QtGui/private/qinternalmimedata_p.h>
#include <wrl.h> #include <wrl.h>

View File

@ -47,7 +47,7 @@
#include "qwinrteglcontext.h" #include "qwinrteglcontext.h"
#include "qwinrttheme.h" #include "qwinrttheme.h"
#include "qwinrtclipboard.h" #include "qwinrtclipboard.h"
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
#include "qwinrtdrag.h" #include "qwinrtdrag.h"
#endif #endif
@ -308,12 +308,12 @@ QPlatformClipboard *QWinRTIntegration::clipboard() const
return d->clipboard; return d->clipboard;
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPlatformDrag *QWinRTIntegration::drag() const QPlatformDrag *QWinRTIntegration::drag() const
{ {
return QWinRTDrag::instance(); return QWinRTDrag::instance();
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
Qt::KeyboardModifiers QWinRTIntegration::queryKeyboardModifiers() const Qt::KeyboardModifiers QWinRTIntegration::queryKeyboardModifiers() const
{ {

View File

@ -97,7 +97,7 @@ public:
QPlatformInputContext *inputContext() const override; QPlatformInputContext *inputContext() const override;
QPlatformServices *services() const override; QPlatformServices *services() const override;
QPlatformClipboard *clipboard() const override; QPlatformClipboard *clipboard() const override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPlatformDrag *drag() const override; QPlatformDrag *drag() const override;
#endif #endif

View File

@ -42,7 +42,7 @@
#include "qwinrtbackingstore.h" #include "qwinrtbackingstore.h"
#include "qwinrtinputcontext.h" #include "qwinrtinputcontext.h"
#include "qwinrtcursor.h" #include "qwinrtcursor.h"
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
#include "qwinrtdrag.h" #include "qwinrtdrag.h"
#endif #endif
#include "qwinrtwindow.h" #include "qwinrtwindow.h"
@ -567,7 +567,7 @@ QWinRTScreen::QWinRTScreen()
ComPtr<Xaml::IUIElement> uiElement; ComPtr<Xaml::IUIElement> uiElement;
hr = canvas.As(&uiElement); hr = canvas.As(&uiElement);
Q_ASSERT_SUCCEEDED(hr); Q_ASSERT_SUCCEEDED(hr);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QWinRTDrag::instance()->setUiElement(uiElement); QWinRTDrag::instance()->setUiElement(uiElement);
#endif #endif
hr = window->put_Content(uiElement.Get()); hr = window->put_Content(uiElement.Get());
@ -850,7 +850,7 @@ void QWinRTScreen::addWindow(QWindow *window)
handleExpose(); handleExpose();
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QWinRTDrag::instance()->setDropTarget(window); QWinRTDrag::instance()->setDropTarget(window);
#endif #endif
} }
@ -869,7 +869,7 @@ void QWinRTScreen::removeWindow(QWindow *window)
QWindowSystemInterface::handleWindowActivated(nullptr, Qt::OtherFocusReason); QWindowSystemInterface::handleWindowActivated(nullptr, Qt::OtherFocusReason);
handleExpose(); handleExpose();
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (wasTopWindow) if (wasTopWindow)
QWinRTDrag::instance()->setDropTarget(topWindow()); QWinRTDrag::instance()->setDropTarget(topWindow());
#endif #endif

View File

@ -15,7 +15,6 @@ SOURCES = \
qwinrtbackingstore.cpp \ qwinrtbackingstore.cpp \
qwinrtclipboard.cpp \ qwinrtclipboard.cpp \
qwinrtcursor.cpp \ qwinrtcursor.cpp \
qwinrtdrag.cpp \
qwinrteglcontext.cpp \ qwinrteglcontext.cpp \
qwinrteventdispatcher.cpp \ qwinrteventdispatcher.cpp \
qwinrtfiledialoghelper.cpp \ qwinrtfiledialoghelper.cpp \
@ -33,7 +32,6 @@ HEADERS = \
qwinrtbackingstore.h \ qwinrtbackingstore.h \
qwinrtclipboard.h \ qwinrtclipboard.h \
qwinrtcursor.h \ qwinrtcursor.h \
qwinrtdrag.h \
qwinrteglcontext.h \ qwinrteglcontext.h \
qwinrteventdispatcher.h \ qwinrteventdispatcher.h \
qwinrtfiledialoghelper.h \ qwinrtfiledialoghelper.h \
@ -53,9 +51,9 @@ WINRT_SDK_VERSION = $$member($$list($$split(WINRT_SDK_VERSION_STRING, .)), 2)
lessThan(WINRT_SDK_VERSION, 14322): DEFINES += QT_WINRT_LIMITED_DRAGANDDROP lessThan(WINRT_SDK_VERSION, 14322): DEFINES += QT_WINRT_LIMITED_DRAGANDDROP
greaterThan(WINRT_SDK_VERSION, 14393): DEFINES += QT_WINRT_DISABLE_PHONE_COLORS greaterThan(WINRT_SDK_VERSION, 14393): DEFINES += QT_WINRT_DISABLE_PHONE_COLORS
contains(DEFINES, QT_NO_DRAGANDDROP) { qtConfig(draganddrop) {
SOURCES -= qwinrtdrag.cpp SOURCES += qwinrtdrag.cpp
HEADERS -= qwinrtdrag.h HEADERS += qwinrtdrag.h
} }
PLUGIN_TYPE = platforms PLUGIN_TYPE = platforms

View File

@ -46,7 +46,9 @@
#include "qxcbscreen.h" #include "qxcbscreen.h"
#include "qxcbwindow.h" #include "qxcbwindow.h"
#include "qxcbclipboard.h" #include "qxcbclipboard.h"
#if QT_CONFIG(draganddrop)
#include "qxcbdrag.h" #include "qxcbdrag.h"
#endif
#include "qxcbwmsupport.h" #include "qxcbwmsupport.h"
#include "qxcbnativeinterface.h" #include "qxcbnativeinterface.h"
#include "qxcbintegration.h" #include "qxcbintegration.h"
@ -604,7 +606,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
m_clipboard = new QXcbClipboard(this); m_clipboard = new QXcbClipboard(this);
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
m_drag = new QXcbDrag(this); m_drag = new QXcbDrag(this);
#endif #endif
@ -648,7 +650,7 @@ QXcbConnection::~QXcbConnection()
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
delete m_clipboard; delete m_clipboard;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
delete m_drag; delete m_drag;
#endif #endif
if (m_reader && m_reader->isRunning()) { if (m_reader && m_reader->isRunning()) {
@ -1139,7 +1141,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
#if QT_CONFIG(draganddrop) || QT_CONFIG(clipboard) #if QT_CONFIG(draganddrop) || QT_CONFIG(clipboard)
xcb_selection_request_event_t *sr = reinterpret_cast<xcb_selection_request_event_t *>(event); xcb_selection_request_event_t *sr = reinterpret_cast<xcb_selection_request_event_t *>(event);
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (sr->selection == atom(QXcbAtom::XdndSelection)) if (sr->selection == atom(QXcbAtom::XdndSelection))
m_drag->handleSelectionRequest(sr); m_drag->handleSelectionRequest(sr);
else else
@ -1802,7 +1804,7 @@ void QXcbConnection::handleClientMessageEvent(const xcb_client_message_event_t *
if (event->format != 32) if (event->format != 32)
return; return;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (event->type == atom(QXcbAtom::XdndStatus)) { if (event->type == atom(QXcbAtom::XdndStatus)) {
drag()->handleStatus(event); drag()->handleStatus(event);
} else if (event->type == atom(QXcbAtom::XdndFinished)) { } else if (event->type == atom(QXcbAtom::XdndFinished)) {

View File

@ -424,7 +424,7 @@ public:
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
QXcbClipboard *clipboard() const { return m_clipboard; } QXcbClipboard *clipboard() const { return m_clipboard; }
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QXcbDrag *drag() const { return m_drag; } QXcbDrag *drag() const { return m_drag; }
#endif #endif
@ -673,7 +673,7 @@ private:
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
QXcbClipboard *m_clipboard = nullptr; QXcbClipboard *m_clipboard = nullptr;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QXcbDrag *m_drag = nullptr; QXcbDrag *m_drag = nullptr;
#endif #endif
QScopedPointer<QXcbWMSupport> m_wmSupport; QScopedPointer<QXcbWMSupport> m_wmSupport;

View File

@ -63,8 +63,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#ifndef QT_NO_DRAGANDDROP
//#define DND_DEBUG //#define DND_DEBUG
#ifdef DND_DEBUG #ifdef DND_DEBUG
#define DEBUG qDebug #define DEBUG qDebug
@ -1312,6 +1310,4 @@ QStringList QXcbDropData::formats_sys() const
return formats; return formats;
} }
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -55,9 +55,9 @@
#include <QtCore/QDebug> #include <QtCore/QDebug>
QT_BEGIN_NAMESPACE QT_REQUIRE_CONFIG(draganddrop);
#ifndef QT_NO_DRAGANDDROP QT_BEGIN_NAMESPACE
class QWindow; class QWindow;
class QPlatformWindow; class QPlatformWindow;
@ -173,8 +173,6 @@ private:
}; };
Q_DECLARE_TYPEINFO(QXcbDrag::Transaction, Q_MOVABLE_TYPE); Q_DECLARE_TYPEINFO(QXcbDrag::Transaction, Q_MOVABLE_TYPE);
#endif // QT_NO_DRAGANDDROP
QT_END_NAMESPACE QT_END_NAMESPACE
#endif #endif

View File

@ -46,7 +46,9 @@
#include "qxcbbackingstore.h" #include "qxcbbackingstore.h"
#include "qxcbnativeinterface.h" #include "qxcbnativeinterface.h"
#include "qxcbclipboard.h" #include "qxcbclipboard.h"
#if QT_CONFIG(draganddrop)
#include "qxcbdrag.h" #include "qxcbdrag.h"
#endif
#include "qxcbglintegration.h" #include "qxcbglintegration.h"
#ifndef QT_NO_SESSIONMANAGER #ifndef QT_NO_SESSIONMANAGER
@ -376,7 +378,7 @@ QPlatformClipboard *QXcbIntegration::clipboard() const
} }
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPlatformDrag *QXcbIntegration::drag() const QPlatformDrag *QXcbIntegration::drag() const
{ {
return m_connections.at(0)->drag(); return m_connections.at(0)->drag();

View File

@ -84,7 +84,7 @@ public:
#ifndef QT_NO_CLIPBOARD #ifndef QT_NO_CLIPBOARD
QPlatformClipboard *clipboard() const override; QPlatformClipboard *clipboard() const override;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPlatformDrag *drag() const override; QPlatformDrag *drag() const override;
#endif #endif

View File

@ -46,8 +46,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
QXcbMime::QXcbMime() QXcbMime::QXcbMime()
: QInternalMimeData() : QInternalMimeData()
{ } { }
@ -320,6 +318,4 @@ xcb_atom_t QXcbMime::mimeAtomForFormat(QXcbConnection *connection, const QString
return 0; return 0;
} }
#endif // !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -40,7 +40,7 @@
#ifndef QXCBMIME_H #ifndef QXCBMIME_H
#define QXCBMIME_H #define QXCBMIME_H
#include <private/qdnd_p.h> #include <QtGui/private/qinternalmimedata_p.h>
#include <QtGui/QClipboard> #include <QtGui/QClipboard>
@ -49,8 +49,6 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
class QXcbMime : public QInternalMimeData { class QXcbMime : public QInternalMimeData {
Q_OBJECT Q_OBJECT
public: public:
@ -67,9 +65,6 @@ public:
const QVector<xcb_atom_t> &atoms, QByteArray *requestedEncoding); const QVector<xcb_atom_t> &atoms, QByteArray *requestedEncoding);
}; };
#endif // !(defined(QT_NO_DRAGANDDROP) && defined(QT_NO_CLIPBOARD))
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QXCBMIME_H #endif // QXCBMIME_H

View File

@ -49,7 +49,9 @@
#include "qxcbintegration.h" #include "qxcbintegration.h"
#include "qxcbconnection.h" #include "qxcbconnection.h"
#include "qxcbscreen.h" #include "qxcbscreen.h"
#if QT_CONFIG(draganddrop)
#include "qxcbdrag.h" #include "qxcbdrag.h"
#endif
#include "qxcbkeyboard.h" #include "qxcbkeyboard.h"
#include "qxcbimage.h" #include "qxcbimage.h"
#include "qxcbwmsupport.h" #include "qxcbwmsupport.h"
@ -541,7 +543,7 @@ void QXcbWindow::create()
XSync(static_cast<Display*>(platformScreen->connection()->xlib_display()), false); XSync(static_cast<Display*>(platformScreen->connection()->xlib_display()), false);
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
connection()->drag()->dndEnable(this, true); connection()->drag()->dndEnable(this, true);
#endif #endif
@ -1983,7 +1985,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
qCWarning(lcQpaXcb, "Unhandled WM_PROTOCOLS (%s)", qCWarning(lcQpaXcb, "Unhandled WM_PROTOCOLS (%s)",
connection()->atomName(protocolAtom).constData()); connection()->atomName(protocolAtom).constData());
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
} else if (event->type == atom(QXcbAtom::XdndEnter)) { } else if (event->type == atom(QXcbAtom::XdndEnter)) {
connection()->drag()->handleEnter(this, event); connection()->drag()->handleEnter(this, event);
} else if (event->type == atom(QXcbAtom::XdndPosition)) { } else if (event->type == atom(QXcbAtom::XdndPosition)) {

View File

@ -19,7 +19,6 @@ SOURCES = \
qxcbintegration.cpp \ qxcbintegration.cpp \
qxcbkeyboard.cpp \ qxcbkeyboard.cpp \
qxcbmime.cpp \ qxcbmime.cpp \
qxcbdrag.cpp \
qxcbscreen.cpp \ qxcbscreen.cpp \
qxcbwindow.cpp \ qxcbwindow.cpp \
qxcbbackingstore.cpp \ qxcbbackingstore.cpp \
@ -35,7 +34,6 @@ HEADERS = \
qxcbconnection.h \ qxcbconnection.h \
qxcbintegration.h \ qxcbintegration.h \
qxcbkeyboard.h \ qxcbkeyboard.h \
qxcbdrag.h \
qxcbmime.h \ qxcbmime.h \
qxcbobject.h \ qxcbobject.h \
qxcbscreen.h \ qxcbscreen.h \
@ -49,6 +47,11 @@ HEADERS = \
qxcbsystemtraytracker.h \ qxcbsystemtraytracker.h \
qxcbxkbcommon.h qxcbxkbcommon.h
qtConfig(draganddrop) {
SOURCES += qxcbdrag.cpp
HEADERS += qxcbdrag.h
}
load(qt_build_paths) load(qt_build_paths)
DEFINES += QT_BUILD_XCB_PLUGIN DEFINES += QT_BUILD_XCB_PLUGIN

View File

@ -45,7 +45,9 @@
#include "qdrawutil.h" #include "qdrawutil.h"
#include "qevent.h" #include "qevent.h"
#include "qimage.h" #include "qimage.h"
#include "qdrag.h" #if QT_CONFIG(draganddrop)
#include <qdrag.h>
#endif
#include "qlabel.h" #include "qlabel.h"
#include "qlayout.h" #include "qlayout.h"
#include "qlineedit.h" #include "qlineedit.h"
@ -592,7 +594,7 @@ protected:
void mousePressEvent(QMouseEvent *e) override; void mousePressEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *e) override; void dragEnterEvent(QDragEnterEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override;
void dragMoveEvent(QDragMoveEvent *e) override; void dragMoveEvent(QDragMoveEvent *e) override;
@ -624,7 +626,7 @@ void QColorWell::mousePressEvent(QMouseEvent *e)
void QColorWell::mouseMoveEvent(QMouseEvent *e) void QColorWell::mouseMoveEvent(QMouseEvent *e)
{ {
QWellArray::mouseMoveEvent(e); QWellArray::mouseMoveEvent(e);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (!mousePressed) if (!mousePressed)
return; return;
if ((pressPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { if ((pressPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) {
@ -647,7 +649,7 @@ void QColorWell::mouseMoveEvent(QMouseEvent *e)
#endif #endif
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QColorWell::dragEnterEvent(QDragEnterEvent *e) void QColorWell::dragEnterEvent(QDragEnterEvent *e)
{ {
if (qvariant_cast<QColor>(e->mimeData()->colorData()).isValid()) if (qvariant_cast<QColor>(e->mimeData()->colorData()).isValid())
@ -684,7 +686,7 @@ void QColorWell::dropEvent(QDropEvent *e)
} }
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
void QColorWell::mouseReleaseEvent(QMouseEvent *e) void QColorWell::mouseReleaseEvent(QMouseEvent *e)
{ {
@ -1072,7 +1074,7 @@ protected:
void mousePressEvent(QMouseEvent *e) override; void mousePressEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *e) override; void dragEnterEvent(QDragEnterEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override;
void dropEvent(QDropEvent *e) override; void dropEvent(QDropEvent *e) override;
@ -1110,7 +1112,7 @@ void QColorShowLabel::mousePressEvent(QMouseEvent *e)
void QColorShowLabel::mouseMoveEvent(QMouseEvent *e) void QColorShowLabel::mouseMoveEvent(QMouseEvent *e)
{ {
#ifdef QT_NO_DRAGANDDROP #if !QT_CONFIG(draganddrop)
Q_UNUSED(e); Q_UNUSED(e);
#else #else
if (!mousePressed) if (!mousePressed)
@ -1132,7 +1134,7 @@ void QColorShowLabel::mouseMoveEvent(QMouseEvent *e)
#endif #endif
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QColorShowLabel::dragEnterEvent(QDragEnterEvent *e) void QColorShowLabel::dragEnterEvent(QDragEnterEvent *e)
{ {
if (qvariant_cast<QColor>(e->mimeData()->colorData()).isValid()) if (qvariant_cast<QColor>(e->mimeData()->colorData()).isValid())
@ -1157,7 +1159,7 @@ void QColorShowLabel::dropEvent(QDropEvent *e)
e->ignore(); e->ignore();
} }
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
void QColorShowLabel::mouseReleaseEvent(QMouseEvent *) void QColorShowLabel::mouseReleaseEvent(QMouseEvent *)
{ {

View File

@ -3945,7 +3945,7 @@ void QFileDialogListView::setFileDialogPrivate(QFileDialogPrivate *d_pointer)
setResizeMode(QListView::Adjust); setResizeMode(QListView::Adjust);
setEditTriggers(QAbstractItemView::EditKeyPressed); setEditTriggers(QAbstractItemView::EditKeyPressed);
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
setDragDropMode(QAbstractItemView::InternalMove); setDragDropMode(QAbstractItemView::InternalMove);
#endif #endif
} }
@ -3986,7 +3986,7 @@ void QFileDialogTreeView::setFileDialogPrivate(QFileDialogPrivate *d_pointer)
setTextElideMode(Qt::ElideMiddle); setTextElideMode(Qt::ElideMiddle);
setEditTriggers(QAbstractItemView::EditKeyPressed); setEditTriggers(QAbstractItemView::EditKeyPressed);
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
setDragDropMode(QAbstractItemView::InternalMove); setDragDropMode(QAbstractItemView::InternalMove);
#endif #endif
} }

View File

@ -118,7 +118,7 @@ QMimeData *QUrlModel::mimeData(const QModelIndexList &indexes) const
return data; return data;
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
Decide based upon the data if it should be accepted or not Decide based upon the data if it should be accepted or not
@ -154,7 +154,7 @@ bool QUrlModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
return true; return true;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
\reimp \reimp
@ -391,7 +391,7 @@ void QSidebar::setModelAndUrls(QFileSystemModel *model, const QList<QUrl> &newUr
connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
this, SLOT(clicked(QModelIndex))); this, SLOT(clicked(QModelIndex)));
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
setDragDropMode(QAbstractItemView::DragDrop); setDragDropMode(QAbstractItemView::DragDrop);
#endif #endif
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
@ -405,13 +405,13 @@ QSidebar::~QSidebar()
{ {
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QSidebar::dragEnterEvent(QDragEnterEvent *event) void QSidebar::dragEnterEvent(QDragEnterEvent *event)
{ {
if (urlModel->canDrop(event)) if (urlModel->canDrop(event))
QListView::dragEnterEvent(event); QListView::dragEnterEvent(event);
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
QSize QSidebar::sizeHint() const QSize QSidebar::sizeHint() const
{ {

View File

@ -86,7 +86,7 @@ public:
QStringList mimeTypes() const override; QStringList mimeTypes() const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override; QMimeData *mimeData(const QModelIndexList &indexes) const override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
bool canDrop(QDragEnterEvent *event); bool canDrop(QDragEnterEvent *event);
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
#endif #endif
@ -142,7 +142,7 @@ public:
protected: protected:
bool event(QEvent * e) override; bool event(QEvent * e) override;
void focusInEvent(QFocusEvent *event) override; void focusInEvent(QFocusEvent *event) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *event) override; void dragEnterEvent(QDragEnterEvent *event) override;
#endif #endif

View File

@ -1050,13 +1050,13 @@ void QGraphicsProxyWidget::contextMenuEvent(QGraphicsSceneContextMenuEvent *even
} }
#endif // QT_NO_CONTEXTMENU #endif // QT_NO_CONTEXTMENU
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
\reimp \reimp
*/ */
void QGraphicsProxyWidget::dragEnterEvent(QGraphicsSceneDragDropEvent *event) void QGraphicsProxyWidget::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{ {
#ifdef QT_NO_DRAGANDDROP #if !QT_CONFIG(draganddrop)
Q_UNUSED(event); Q_UNUSED(event);
#else #else
Q_D(QGraphicsProxyWidget); Q_D(QGraphicsProxyWidget);
@ -1077,7 +1077,7 @@ void QGraphicsProxyWidget::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
Q_D(QGraphicsProxyWidget); Q_D(QGraphicsProxyWidget);
if (!d->widget || !d->dragDropWidget) if (!d->widget || !d->dragDropWidget)
return; return;
@ -1092,7 +1092,7 @@ void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
*/ */
void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event) void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
{ {
#ifdef QT_NO_DRAGANDDROP #if !QT_CONFIG(draganddrop)
Q_UNUSED(event); Q_UNUSED(event);
#else #else
Q_D(QGraphicsProxyWidget); Q_D(QGraphicsProxyWidget);
@ -1158,7 +1158,7 @@ void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
*/ */
void QGraphicsProxyWidget::dropEvent(QGraphicsSceneDragDropEvent *event) void QGraphicsProxyWidget::dropEvent(QGraphicsSceneDragDropEvent *event)
{ {
#ifdef QT_NO_DRAGANDDROP #if !QT_CONFIG(draganddrop)
Q_UNUSED(event); Q_UNUSED(event);
#else #else
Q_D(QGraphicsProxyWidget); Q_D(QGraphicsProxyWidget);

View File

@ -85,7 +85,7 @@ protected:
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override; void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override; void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override; void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override; void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;

View File

@ -850,7 +850,7 @@ void QGraphicsViewPrivate::storeDragDropEvent(const QGraphicsSceneDragDropEvent
void QGraphicsViewPrivate::populateSceneDragDropEvent(QGraphicsSceneDragDropEvent *dest, void QGraphicsViewPrivate::populateSceneDragDropEvent(QGraphicsSceneDragDropEvent *dest,
QDropEvent *source) QDropEvent *source)
{ {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
Q_Q(QGraphicsView); Q_Q(QGraphicsView);
dest->setScenePos(q->mapToScene(source->pos())); dest->setScenePos(q->mapToScene(source->pos()));
dest->setScreenPos(q->mapToGlobal(source->pos())); dest->setScreenPos(q->mapToGlobal(source->pos()));

View File

@ -63,9 +63,11 @@
#include <private/qabstractitemdelegate_p.h> #include <private/qabstractitemdelegate_p.h>
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h> #include <qpa/qplatformdrag.h>
#include <private/qguiapplication_p.h>
#include <private/qdnd_p.h> #include <private/qdnd_p.h>
#endif
#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -515,7 +517,7 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
return false; return false;
w = w->parentWidget(); w = w->parentWidget();
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
// The window may lose focus during an drag operation. // The window may lose focus during an drag operation.
// i.e when dragging involves the taskbar on Windows. // i.e when dragging involves the taskbar on Windows.
QPlatformDrag *platformDrag = QGuiApplicationPrivate::instance()->platformIntegration()->drag(); QPlatformDrag *platformDrag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();

View File

@ -44,7 +44,9 @@
#include <qclipboard.h> #include <qclipboard.h>
#include <qpainter.h> #include <qpainter.h>
#include <qstyle.h> #include <qstyle.h>
#if QT_CONFIG(draganddrop)
#include <qdrag.h> #include <qdrag.h>
#endif
#include <qevent.h> #include <qevent.h>
#include <qscrollbar.h> #include <qscrollbar.h>
#include <qtooltip.h> #include <qtooltip.h>
@ -90,7 +92,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
editTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed), editTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed),
lastTrigger(QAbstractItemView::NoEditTriggers), lastTrigger(QAbstractItemView::NoEditTriggers),
tabKeyNavigation(false), tabKeyNavigation(false),
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
showDropIndicator(true), showDropIndicator(true),
dragEnabled(false), dragEnabled(false),
dragDropMode(QAbstractItemView::NoDragDrop), dragDropMode(QAbstractItemView::NoDragDrop),
@ -1325,7 +1327,7 @@ void QAbstractItemView::resetHorizontalScrollMode()
d_func()->horizontalScrollModeSet = false; d_func()->horizontalScrollModeSet = false;
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
\since 4.2 \since 4.2
\property QAbstractItemView::dragDropOverwriteMode \property QAbstractItemView::dragDropOverwriteMode
@ -1432,7 +1434,7 @@ QSize QAbstractItemView::viewportSizeHint() const
return QAbstractScrollArea::viewportSizeHint(); return QAbstractScrollArea::viewportSizeHint();
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
\property QAbstractItemView::showDropIndicator \property QAbstractItemView::showDropIndicator
\brief whether the drop indicator is shown when dragging items and dropping. \brief whether the drop indicator is shown when dragging items and dropping.
@ -1551,7 +1553,7 @@ Qt::DropAction QAbstractItemView::defaultDropAction() const
return d->defaultDropAction; return d->defaultDropAction;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
\property QAbstractItemView::alternatingRowColors \property QAbstractItemView::alternatingRowColors
@ -1828,7 +1830,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
if (state() == ExpandingState || state() == CollapsingState) if (state() == ExpandingState || state() == CollapsingState)
return; return;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (state() == DraggingState) { if (state() == DraggingState) {
topLeft = d->pressedPosition - d->offset(); topLeft = d->pressedPosition - d->offset();
if ((topLeft - bottomRight).manhattanLength() > QApplication::startDragDistance()) { if ((topLeft - bottomRight).manhattanLength() > QApplication::startDragDistance()) {
@ -1839,7 +1841,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
} }
return; return;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
QPersistentModelIndex index = indexAt(bottomRight); QPersistentModelIndex index = indexAt(bottomRight);
QModelIndex buddy = d->model->buddy(d->pressedIndex); QModelIndex buddy = d->model->buddy(d->pressedIndex);
@ -1854,7 +1856,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
d->checkMouseMove(index); d->checkMouseMove(index);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (d->pressedIndex.isValid() if (d->pressedIndex.isValid()
&& d->dragEnabled && d->dragEnabled
&& (state() != DragSelectingState) && (state() != DragSelectingState)
@ -1962,7 +1964,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
emit activated(persistent); emit activated(persistent);
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
This function is called with the given \a event when a drag and drop operation enters This function is called with the given \a event when a drag and drop operation enters
@ -2216,7 +2218,7 @@ QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, const Q
return r; return r;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
This function is called with the given \a event when the widget obtains the focus. This function is called with the given \a event when the widget obtains the focus.
@ -2567,7 +2569,7 @@ void QAbstractItemView::inputMethodEvent(QInputMethodEvent *event)
} }
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
\enum QAbstractItemView::DropIndicatorPosition \enum QAbstractItemView::DropIndicatorPosition
@ -3667,7 +3669,7 @@ void QAbstractItemView::currentChanged(const QModelIndex &current, const QModelI
setAttribute(Qt::WA_InputMethodEnabled, (current.isValid() && (current.flags() & Qt::ItemIsEditable))); setAttribute(Qt::WA_InputMethodEnabled, (current.isValid() && (current.flags() & Qt::ItemIsEditable)));
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
Starts a drag by calling drag->exec() using the given \a supportedActions. Starts a drag by calling drag->exec() using the given \a supportedActions.
*/ */
@ -3698,7 +3700,7 @@ void QAbstractItemView::startDrag(Qt::DropActions supportedActions)
d->dropIndicatorPosition = OnItem; d->dropIndicatorPosition = OnItem;
} }
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
Returns a QStyleOptionViewItem structure populated with the view's Returns a QStyleOptionViewItem structure populated with the view's
@ -3911,7 +3913,7 @@ void QAbstractItemView::doAutoScroll()
if (verticalUnchanged && horizontalUnchanged) { if (verticalUnchanged && horizontalUnchanged) {
stopAutoScroll(); stopAutoScroll();
} else { } else {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
d->dropIndicatorRect = QRect(); d->dropIndicatorRect = QRect();
d->dropIndicatorPosition = QAbstractItemView::OnViewport; d->dropIndicatorPosition = QAbstractItemView::OnViewport;
#endif #endif
@ -4286,7 +4288,7 @@ void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QMo
*/ */
void QAbstractItemViewPrivate::clearOrRemove() void QAbstractItemViewPrivate::clearOrRemove()
{ {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
const QItemSelection selection = selectionModel->selection(); const QItemSelection selection = selectionModel->selection();
QList<QItemSelectionRange>::const_iterator it = selection.constBegin(); QList<QItemSelectionRange>::const_iterator it = selection.constBegin();

View File

@ -65,7 +65,7 @@ class Q_WIDGETS_EXPORT QAbstractItemView : public QAbstractScrollArea
Q_PROPERTY(int autoScrollMargin READ autoScrollMargin WRITE setAutoScrollMargin) Q_PROPERTY(int autoScrollMargin READ autoScrollMargin WRITE setAutoScrollMargin)
Q_PROPERTY(EditTriggers editTriggers READ editTriggers WRITE setEditTriggers) Q_PROPERTY(EditTriggers editTriggers READ editTriggers WRITE setEditTriggers)
Q_PROPERTY(bool tabKeyNavigation READ tabKeyNavigation WRITE setTabKeyNavigation) Q_PROPERTY(bool tabKeyNavigation READ tabKeyNavigation WRITE setTabKeyNavigation)
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
Q_PROPERTY(bool showDropIndicator READ showDropIndicator WRITE setDropIndicatorShown) Q_PROPERTY(bool showDropIndicator READ showDropIndicator WRITE setDropIndicatorShown)
Q_PROPERTY(bool dragEnabled READ dragEnabled WRITE setDragEnabled) Q_PROPERTY(bool dragEnabled READ dragEnabled WRITE setDragEnabled)
Q_PROPERTY(bool dragDropOverwriteMode READ dragDropOverwriteMode WRITE setDragDropOverwriteMode) Q_PROPERTY(bool dragDropOverwriteMode READ dragDropOverwriteMode WRITE setDragDropOverwriteMode)
@ -165,7 +165,7 @@ public:
void setTabKeyNavigation(bool enable); void setTabKeyNavigation(bool enable);
bool tabKeyNavigation() const; bool tabKeyNavigation() const;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void setDropIndicatorShown(bool enable); void setDropIndicatorShown(bool enable);
bool showDropIndicator() const; bool showDropIndicator() const;
@ -297,7 +297,7 @@ protected:
virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index, virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index,
const QEvent *event = nullptr) const; const QEvent *event = nullptr) const;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual void startDrag(Qt::DropActions supportedActions); virtual void startDrag(Qt::DropActions supportedActions);
#endif #endif
@ -334,7 +334,7 @@ protected:
void mouseMoveEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override; void mouseDoubleClickEvent(QMouseEvent *event) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *event) override; void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override; void dragMoveEvent(QDragMoveEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override; void dragLeaveEvent(QDragLeaveEvent *event) override;
@ -348,7 +348,7 @@ protected:
void inputMethodEvent(QInputMethodEvent *event) override; void inputMethodEvent(QInputMethodEvent *event) override;
bool eventFilter(QObject *object, QEvent *event) override; bool eventFilter(QObject *object, QEvent *event) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
enum DropIndicatorPosition { OnItem, AboveItem, BelowItem, OnViewport }; enum DropIndicatorPosition { OnItem, AboveItem, BelowItem, OnViewport };
DropIndicatorPosition dropIndicatorPosition() const; DropIndicatorPosition dropIndicatorPosition() const;
#endif #endif

View File

@ -130,7 +130,7 @@ public:
} }
void stopAutoScroll() { autoScrollTimer.stop(); autoScrollCount = 0;} void stopAutoScroll() { autoScrollTimer.stop(); autoScrollCount = 0;}
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index); virtual bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index);
#endif #endif
bool droppingOnItself(QDropEvent *event, const QModelIndex &index); bool droppingOnItself(QDropEvent *event, const QModelIndex &index);
@ -162,7 +162,7 @@ public:
} }
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const; virtual QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const;
inline bool canDrop(QDropEvent *event) { inline bool canDrop(QDropEvent *event) {
@ -400,7 +400,7 @@ public:
bool tabKeyNavigation; bool tabKeyNavigation;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
bool showDropIndicator; bool showDropIndicator;
QRect dropIndicatorRect; QRect dropIndicatorRect;
bool dragEnabled; bool dragEnabled;

View File

@ -772,7 +772,7 @@ void QColumnView::initializeColumn(QAbstractItemView *column) const
column->setMinimumWidth(100); column->setMinimumWidth(100);
column->setAttribute(Qt::WA_MacShowFocusRect, false); column->setAttribute(Qt::WA_MacShowFocusRect, false);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
column->setDragDropMode(dragDropMode()); column->setDragDropMode(dragDropMode());
column->setDragDropOverwriteMode(dragDropOverwriteMode()); column->setDragDropOverwriteMode(dragDropOverwriteMode());
column->setDropIndicatorShown(showDropIndicator()); column->setDropIndicatorShown(showDropIndicator());

View File

@ -44,7 +44,9 @@
#include <qapplication.h> #include <qapplication.h>
#include <qpainter.h> #include <qpainter.h>
#include <qbitmap.h> #include <qbitmap.h>
#if QT_CONFIG(draganddrop)
#include <qdrag.h> #include <qdrag.h>
#endif
#include <qvector.h> #include <qvector.h>
#include <qstyle.h> #include <qstyle.h>
#include <qevent.h> #include <qevent.h>
@ -230,7 +232,7 @@ void QListView::setMovement(Movement movement)
d->modeProperties |= uint(QListViewPrivate::Movement); d->modeProperties |= uint(QListViewPrivate::Movement);
d->movement = movement; d->movement = movement;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
bool movable = (movement != Static); bool movable = (movement != Static);
setDragEnabled(movable); setDragEnabled(movable);
d->viewport->setAcceptDrops(movable); d->viewport->setAcceptDrops(movable);
@ -494,7 +496,7 @@ void QListView::setViewMode(ViewMode mode)
d->showElasticBand = true; d->showElasticBand = true;
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
bool movable = (d->movement != Static); bool movable = (d->movement != Static);
setDragEnabled(movable); setDragEnabled(movable);
setAcceptDrops(movable); setAcceptDrops(movable);
@ -875,7 +877,7 @@ void QListView::resizeEvent(QResizeEvent *e)
} }
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
\reimp \reimp
@ -919,7 +921,7 @@ void QListView::startDrag(Qt::DropActions supportedActions)
QAbstractItemView::startDrag(supportedActions); QAbstractItemView::startDrag(supportedActions);
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
\reimp \reimp
@ -1048,7 +1050,7 @@ void QListView::paintEvent(QPaintEvent *e)
d->delegateForIndex(*it)->paint(&painter, option, *it); d->delegateForIndex(*it)->paint(&painter, option, *it);
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
d->commonListView->paintDragDrop(&painter); d->commonListView->paintDragDrop(&painter);
#endif #endif
@ -1829,7 +1831,7 @@ QItemSelection QListViewPrivate::selection(const QRect &rect) const
return selection; return selection;
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QAbstractItemView::DropIndicatorPosition QListViewPrivate::position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const QAbstractItemView::DropIndicatorPosition QListViewPrivate::position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const
{ {
if (viewMode == QListView::ListMode && flow == QListView::LeftToRight) if (viewMode == QListView::ListMode && flow == QListView::LeftToRight)
@ -1871,7 +1873,7 @@ void QCommonListViewBase::removeHiddenRow(int row)
dd->hiddenRows.remove(dd->model->index(row, 0, qq->rootIndex())); dd->hiddenRows.remove(dd->model->index(row, 0, qq->rootIndex()));
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QCommonListViewBase::paintDragDrop(QPainter *painter) void QCommonListViewBase::paintDragDrop(QPainter *painter)
{ {
// FIXME: Until the we can provide a proper drop indicator // FIXME: Until the we can provide a proper drop indicator
@ -2006,7 +2008,7 @@ QListModeViewBase::QListModeViewBase(QListView *q, QListViewPrivate *d)
#endif #endif
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QAbstractItemView::DropIndicatorPosition QListModeViewBase::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const QAbstractItemView::DropIndicatorPosition QListModeViewBase::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const
{ {
QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport; QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport;
@ -2165,7 +2167,7 @@ bool QListModeViewBase::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QM
return false; return false;
} }
#endif //QT_NO_DRAGANDDROP #endif //QT_CONFIG(draganddrop)
void QListModeViewBase::updateVerticalScrollBar(const QSize &step) void QListModeViewBase::updateVerticalScrollBar(const QSize &step)
{ {
@ -2740,7 +2742,7 @@ void QIconModeViewBase::removeHiddenRow(int row)
tree.insertLeaf(items.at(row).rect(), row); tree.insertLeaf(items.at(row).rect(), row);
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions) bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions)
{ {
// This function does the same thing as in QAbstractItemView::startDrag(), // This function does the same thing as in QAbstractItemView::startDrag(),
@ -2862,7 +2864,7 @@ bool QIconModeViewBase::filterDragMoveEvent(QDragMoveEvent *e)
dd->startAutoScroll(); dd->startAutoScroll();
return true; return true;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
void QIconModeViewBase::setRowCount(int rowCount) void QIconModeViewBase::setRowCount(int rowCount)
{ {

View File

@ -158,12 +158,12 @@ protected:
void timerEvent(QTimerEvent *e) override; void timerEvent(QTimerEvent *e) override;
void resizeEvent(QResizeEvent *e) override; void resizeEvent(QResizeEvent *e) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragMoveEvent(QDragMoveEvent *e) override; void dragMoveEvent(QDragMoveEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override;
void dropEvent(QDropEvent *e) override; void dropEvent(QDropEvent *e) override;
void startDrag(Qt::DropActions supportedActions) override; void startDrag(Qt::DropActions supportedActions) override;
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
QStyleOptionViewItem viewOptions() const override; QStyleOptionViewItem viewOptions() const override;
void paintEvent(QPaintEvent *e) override; void paintEvent(QPaintEvent *e) override;

View File

@ -143,7 +143,7 @@ public:
virtual void removeHiddenRow(int row); virtual void removeHiddenRow(int row);
virtual void setPositionForIndex(const QPoint &, const QModelIndex &) { } virtual void setPositionForIndex(const QPoint &, const QModelIndex &) { }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual void paintDragDrop(QPainter *painter); virtual void paintDragDrop(QPainter *painter);
virtual bool filterDragMoveEvent(QDragMoveEvent *) { return false; } virtual bool filterDragMoveEvent(QDragMoveEvent *) { return false; }
virtual bool filterDragLeaveEvent(QDragLeaveEvent *) { return false; } virtual bool filterDragLeaveEvent(QDragLeaveEvent *) { return false; }
@ -228,7 +228,7 @@ public:
void updateHorizontalScrollBar(const QSize &step) override; void updateHorizontalScrollBar(const QSize &step) override;
void updateVerticalScrollBar(const QSize &step) override; void updateVerticalScrollBar(const QSize &step) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
// The next two methods are to be used on LefToRight flow only. // The next two methods are to be used on LefToRight flow only.
// WARNING: Plenty of duplicated code from QAbstractItemView{,Private}. // WARNING: Plenty of duplicated code from QAbstractItemView{,Private}.
QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const; QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const;
@ -274,7 +274,7 @@ public:
void removeHiddenRow(int row) override; void removeHiddenRow(int row) override;
void setPositionForIndex(const QPoint &position, const QModelIndex &index) override; void setPositionForIndex(const QPoint &position, const QModelIndex &index) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
bool filterDragMoveEvent(QDragMoveEvent *) override; bool filterDragMoveEvent(QDragMoveEvent *) override;
bool filterDragLeaveEvent(QDragLeaveEvent *) override; bool filterDragLeaveEvent(QDragLeaveEvent *) override;
bool filterDropEvent(QDropEvent *e) override; bool filterDropEvent(QDropEvent *e) override;
@ -358,7 +358,7 @@ public:
QItemSelection selection(const QRect &rect) const; QItemSelection selection(const QRect &rect) const;
void selectAll(QItemSelectionModel::SelectionFlags command) override; void selectAll(QItemSelectionModel::SelectionFlags command) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const override; QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const override;
bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index) override; bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index) override;
#endif #endif

View File

@ -444,7 +444,7 @@ QMimeData *QListModel::mimeData(const QModelIndexList &indexes) const
return mimeData; return mimeData;
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
bool QListModel::dropMimeData(const QMimeData *data, Qt::DropAction action, bool QListModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &index) int row, int column, const QModelIndex &index)
{ {
@ -463,7 +463,7 @@ Qt::DropActions QListModel::supportedDropActions() const
const QListWidget *view = qobject_cast<const QListWidget*>(QObject::parent()); const QListWidget *view = qobject_cast<const QListWidget*>(QObject::parent());
return view->supportedDropActions(); return view->supportedDropActions();
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
\class QListWidgetItem \class QListWidgetItem
@ -1859,7 +1859,7 @@ QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*> items) const
return d->listModel()->internalMimeData(); return d->listModel()->internalMimeData();
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
Handles \a data supplied by an external drag and drop operation that ended Handles \a data supplied by an external drag and drop operation that ended
with the given \a action in the given \a index. Returns \c true if \a data and with the given \a action in the given \a index. Returns \c true if \a data and
@ -1934,7 +1934,7 @@ Qt::DropActions QListWidget::supportedDropActions() const
Q_D(const QListWidget); Q_D(const QListWidget);
return d->listModel()->QAbstractListModel::supportedDropActions() | Qt::MoveAction; return d->listModel()->QAbstractListModel::supportedDropActions() | Qt::MoveAction;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
Returns a list of pointers to the items contained in the \a data object. If Returns a list of pointers to the items contained in the \a data object. If

View File

@ -286,7 +286,7 @@ protected:
#else #else
virtual QMimeData *mimeData(const QList<QListWidgetItem*> items) const; virtual QMimeData *mimeData(const QList<QListWidgetItem*> items) const;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action); virtual bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action);
virtual Qt::DropActions supportedDropActions() const; virtual Qt::DropActions supportedDropActions() const;
#endif #endif

View File

@ -124,7 +124,7 @@ public:
// dnd // dnd
QStringList mimeTypes() const override; QStringList mimeTypes() const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override; QMimeData *mimeData(const QModelIndexList &indexes) const override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
bool dropMimeData(const QMimeData *data, Qt::DropAction action, bool dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent) override; int row, int column, const QModelIndex &parent) override;
Qt::DropActions supportedDropActions() const override; Qt::DropActions supportedDropActions() const override;

View File

@ -1512,7 +1512,7 @@ void QTableView::paintEvent(QPaintEvent *event)
} }
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
// Paint the dropIndicator // Paint the dropIndicator
d->paintDropIndicator(&painter); d->paintDropIndicator(&painter);
#endif #endif

View File

@ -142,7 +142,7 @@ public:
visualCursor(QPoint()) visualCursor(QPoint())
{ {
wrapItemText = true; wrapItemText = true;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
overwrite = true; overwrite = true;
#endif #endif
} }

View File

@ -2618,7 +2618,7 @@ QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem*> items) const
bool QTableWidget::dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action) bool QTableWidget::dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action)
{ {
QModelIndex idx; QModelIndex idx;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (dropIndicatorPosition() == QAbstractItemView::OnItem) { if (dropIndicatorPosition() == QAbstractItemView::OnItem) {
// QAbstractTableModel::dropMimeData will overwrite on the index if row == -1 and column == -1 // QAbstractTableModel::dropMimeData will overwrite on the index if row == -1 and column == -1
idx = model()->index(row, column); idx = model()->index(row, column);
@ -2701,7 +2701,7 @@ bool QTableWidget::event(QEvent *e)
return QTableView::event(e); return QTableView::event(e);
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! \reimp */ /*! \reimp */
void QTableWidget::dropEvent(QDropEvent *event) { void QTableWidget::dropEvent(QDropEvent *event) {
Q_D(QTableWidget); Q_D(QTableWidget);

View File

@ -1287,7 +1287,7 @@ void QTreeView::timerEvent(QTimerEvent *event)
/*! /*!
\reimp \reimp
*/ */
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QTreeView::dragMoveEvent(QDragMoveEvent *event) void QTreeView::dragMoveEvent(QDragMoveEvent *event)
{ {
Q_D(QTreeView); Q_D(QTreeView);
@ -1342,7 +1342,7 @@ void QTreeView::paintEvent(QPaintEvent *event)
#endif //QT_NO_ANIMATION #endif //QT_NO_ANIMATION
{ {
drawTree(&painter, event->region()); drawTree(&painter, event->region());
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
d->paintDropIndicator(&painter); d->paintDropIndicator(&painter);
#endif #endif
} }

View File

@ -201,7 +201,7 @@ protected:
void mouseDoubleClickEvent(QMouseEvent *event) override; void mouseDoubleClickEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override; void keyPressEvent(QKeyEvent *event) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragMoveEvent(QDragMoveEvent *event) override; void dragMoveEvent(QDragMoveEvent *event) override;
#endif #endif
bool viewportEvent(QEvent *event) override; bool viewportEvent(QEvent *event) override;

View File

@ -3394,7 +3394,7 @@ QTreeWidgetItem *QTreeWidget::itemFromIndex(const QModelIndex &index) const
return d->item(index); return d->item(index);
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! \reimp */ /*! \reimp */
void QTreeWidget::dropEvent(QDropEvent *event) { void QTreeWidget::dropEvent(QDropEvent *event) {
Q_D(QTreeWidget); Q_D(QTreeWidget);

View File

@ -63,7 +63,9 @@
#include "qtranslator.h" #include "qtranslator.h"
#include "qvariant.h" #include "qvariant.h"
#include "qwidget.h" #include "qwidget.h"
#include "private/qdnd_p.h" #if QT_CONFIG(draganddrop)
#include <private/qdnd_p.h>
#endif
#include "private/qguiapplication_p.h" #include "private/qguiapplication_p.h"
#include "qcolormap.h" #include "qcolormap.h"
#include "qdebug.h" #include "qdebug.h"
@ -832,7 +834,7 @@ QApplication::~QApplication()
delete QApplicationPrivate::app_style; delete QApplicationPrivate::app_style;
QApplicationPrivate::app_style = 0; QApplicationPrivate::app_style = 0;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (qt_is_gui_used) if (qt_is_gui_used)
delete QDragManager::self(); delete QDragManager::self();
#endif #endif
@ -3429,7 +3431,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
break; break;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case QEvent::DragEnter: { case QEvent::DragEnter: {
QWidget* w = static_cast<QWidget *>(receiver); QWidget* w = static_cast<QWidget *>(receiver);
QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(e); QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(e);
@ -4477,7 +4479,7 @@ void QApplicationPrivate::notifyThemeChanged()
qt_init_tooltip_palette(); qt_init_tooltip_palette();
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QApplicationPrivate::notifyDragStarted(const QDrag *drag) void QApplicationPrivate::notifyDragStarted(const QDrag *drag)
{ {
QGuiApplicationPrivate::notifyDragStarted(drag); QGuiApplicationPrivate::notifyDragStarted(drag);
@ -4488,7 +4490,7 @@ void QApplicationPrivate::notifyDragStarted(const QDrag *drag)
if (qt_button_down && !qt_button_down->inherits("QQuickWidget")) if (qt_button_down && !qt_button_down->inherits("QQuickWidget"))
qt_button_down = nullptr; qt_button_down = nullptr;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
#ifndef QT_NO_GESTURES #ifndef QT_NO_GESTURES
QGestureManager* QGestureManager::instance() QGestureManager* QGestureManager::instance()

View File

@ -177,9 +177,9 @@ public:
protected: protected:
void notifyThemeChanged() override; void notifyThemeChanged() override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void notifyDragStarted(const QDrag *) override; void notifyDragStarted(const QDrag *) override;
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
public: public:
static QFont *sys_font; static QFont *sys_font;

View File

@ -1322,7 +1322,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
<< "Alien?" << !testAttribute(Qt::WA_NativeWindow); << "Alien?" << !testAttribute(Qt::WA_NativeWindow);
#endif #endif
#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ && !defined(QT_NO_DRAGANDDROP) #if 0 /* Used to be included in Qt4 for Q_WS_WIN */ && QT_CONFIG(draganddrop)
// Unregister the dropsite (if already registered) before we // Unregister the dropsite (if already registered) before we
// re-create the widget with a native window. // re-create the widget with a native window.
if (testAttribute(Qt::WA_WState_Created) && !internalWinId() && testAttribute(Qt::WA_NativeWindow) if (testAttribute(Qt::WA_WState_Created) && !internalWinId() && testAttribute(Qt::WA_NativeWindow)
@ -9094,7 +9094,7 @@ bool QWidget::event(QEvent *event)
break; break;
#endif // QT_NO_CONTEXTMENU #endif // QT_NO_CONTEXTMENU
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case QEvent::Drop: case QEvent::Drop:
dropEvent((QDropEvent*) event); dropEvent((QDropEvent*) event);
break; break;
@ -9976,7 +9976,7 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints)
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
\fn void QWidget::dragEnterEvent(QDragEnterEvent *event) \fn void QWidget::dragEnterEvent(QDragEnterEvent *event)
@ -10045,7 +10045,7 @@ void QWidget::dropEvent(QDropEvent *)
{ {
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! /*!
\fn void QWidget::showEvent(QShowEvent *event) \fn void QWidget::showEvent(QShowEvent *event)
@ -11194,7 +11194,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
switch (attribute) { switch (attribute) {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case Qt::WA_AcceptDrops: { case Qt::WA_AcceptDrops: {
if (on && !testAttribute(Qt::WA_DropSiteRegistered)) if (on && !testAttribute(Qt::WA_DropSiteRegistered))
setAttribute(Qt::WA_DropSiteRegistered, true); setAttribute(Qt::WA_DropSiteRegistered, true);

View File

@ -636,7 +636,7 @@ protected:
virtual void actionEvent(QActionEvent *event); virtual void actionEvent(QActionEvent *event);
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual void dragEnterEvent(QDragEnterEvent *event); virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dragMoveEvent(QDragMoveEvent *event); virtual void dragMoveEvent(QDragMoveEvent *event);
virtual void dragLeaveEvent(QDragLeaveEvent *event); virtual void dragLeaveEvent(QDragLeaveEvent *event);

View File

@ -268,7 +268,7 @@ struct QWExtra {
// *************************** Platform specific values (bit fields first) ********** // *************************** Platform specific values (bit fields first) **********
#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ // <----------------------------------------------------------- WIN #if 0 /* Used to be included in Qt4 for Q_WS_WIN */ // <----------------------------------------------------------- WIN
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QOleDropTarget *dropTarget; // drop target QOleDropTarget *dropTarget; // drop target
QList<QPointer<QWidget> > oleDropWidgets; QList<QPointer<QWidget> > oleDropWidgets;
#endif #endif
@ -800,7 +800,7 @@ public:
bool shouldShowMaximizeButton(); bool shouldShowMaximizeButton();
void winUpdateIsOpaque(); void winUpdateIsOpaque();
void reparentChildren(); void reparentChildren();
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QOleDropTarget *registerOleDnd(QWidget *widget); QOleDropTarget *registerOleDnd(QWidget *widget);
void unregisterOleDnd(QWidget *widget, QOleDropTarget *target); void unregisterOleDnd(QWidget *widget, QOleDropTarget *target);
#endif #endif

View File

@ -309,7 +309,7 @@ bool QWidgetWindow::event(QEvent *event)
return true; return true;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case QEvent::DragEnter: case QEvent::DragEnter:
case QEvent::DragMove: case QEvent::DragMove:
handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event)); handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event));
@ -846,7 +846,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event)
#endif // QT_CONFIG(wheelevent) #endif // QT_CONFIG(wheelevent)
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QWidgetWindow::handleDragEnterMoveEvent(QDragMoveEvent *event) void QWidgetWindow::handleDragEnterMoveEvent(QDragMoveEvent *event)
{ {
@ -922,7 +922,7 @@ void QWidgetWindow::handleDropEvent(QDropEvent *event)
m_dragTarget = 0; m_dragTarget = 0;
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
void QWidgetWindow::handleExposeEvent(QExposeEvent *event) void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
{ {

View File

@ -95,7 +95,7 @@ protected:
#if QT_CONFIG(wheelevent) #if QT_CONFIG(wheelevent)
void handleWheelEvent(QWheelEvent *); void handleWheelEvent(QWheelEvent *);
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void handleDragEnterMoveEvent(QDragMoveEvent *); void handleDragEnterMoveEvent(QDragMoveEvent *);
void handleDragLeaveEvent(QDragLeaveEvent *); void handleDragLeaveEvent(QDragLeaveEvent *);
void handleDropEvent(QDropEvent *); void handleDropEvent(QDropEvent *);
@ -132,7 +132,7 @@ private:
QPointer<QWidget> m_widget; QPointer<QWidget> m_widget;
QPointer<QWidget> m_implicit_mouse_grabber; QPointer<QWidget> m_implicit_mouse_grabber;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QPointer<QWidget> m_dragTarget; QPointer<QWidget> m_dragTarget;
#endif #endif
}; };

View File

@ -329,7 +329,7 @@ bool QWindowContainer::event(QEvent *e)
} }
} }
break; break;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case QEvent::Drop: case QEvent::Drop:
case QEvent::DragMove: case QEvent::DragMove:
case QEvent::DragLeave: case QEvent::DragLeave:

View File

@ -136,7 +136,7 @@ static QEvent *cloneEvent(QEvent *e)
return new QEvent(*e); return new QEvent(*e);
case QEvent::DeferredDelete: case QEvent::DeferredDelete:
return new QEvent(*e); return new QEvent(*e);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case QEvent::DragEnter: case QEvent::DragEnter:
return new QDragEnterEvent(*static_cast<QDragEnterEvent*>(e)); return new QDragEnterEvent(*static_cast<QDragEnterEvent*>(e));
case QEvent::DragMove: case QEvent::DragMove:

View File

@ -1065,7 +1065,7 @@ bool QAbstractScrollArea::event(QEvent *e)
case QEvent::MouseButtonDblClick: case QEvent::MouseButtonDblClick:
case QEvent::MouseMove: case QEvent::MouseMove:
case QEvent::Wheel: case QEvent::Wheel:
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case QEvent::Drop: case QEvent::Drop:
case QEvent::DragEnter: case QEvent::DragEnter:
case QEvent::DragMove: case QEvent::DragMove:
@ -1206,7 +1206,7 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e)
#if QT_CONFIG(wheelevent) #if QT_CONFIG(wheelevent)
case QEvent::Wheel: case QEvent::Wheel:
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case QEvent::Drop: case QEvent::Drop:
case QEvent::DragEnter: case QEvent::DragEnter:
case QEvent::DragMove: case QEvent::DragMove:
@ -1409,7 +1409,7 @@ void QAbstractScrollArea::keyPressEvent(QKeyEvent * e)
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! /*!
\fn void QAbstractScrollArea::dragEnterEvent(QDragEnterEvent *event) \fn void QAbstractScrollArea::dragEnterEvent(QDragEnterEvent *event)

View File

@ -122,7 +122,7 @@ protected:
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *) override; void contextMenuEvent(QContextMenuEvent *) override;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *) override; void dragEnterEvent(QDragEnterEvent *) override;
void dragMoveEvent(QDragMoveEvent *) override; void dragMoveEvent(QDragMoveEvent *) override;
void dragLeaveEvent(QDragLeaveEvent *) override; void dragLeaveEvent(QDragLeaveEvent *) override;

View File

@ -43,7 +43,9 @@
#include "qaction.h" #include "qaction.h"
#include "qapplication.h" #include "qapplication.h"
#include "qclipboard.h" #include "qclipboard.h"
#include "qdrag.h" #if QT_CONFIG(draganddrop)
#include <qdrag.h>
#endif
#include "qdrawutil.h" #include "qdrawutil.h"
#include "qevent.h" #include "qevent.h"
#include "qfontmetrics.h" #include "qfontmetrics.h"
@ -1427,7 +1429,7 @@ bool QLineEdit::event(QEvent * e)
// ### Qt6: move to timerEvent, is here for binary compatibility // ### Qt6: move to timerEvent, is here for binary compatibility
int timerId = ((QTimerEvent*)e)->timerId(); int timerId = ((QTimerEvent*)e)->timerId();
if (false) { if (false) {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
} else if (timerId == d->dndTimer.timerId()) { } else if (timerId == d->dndTimer.timerId()) {
d->drag(); d->drag();
#endif #endif
@ -1515,7 +1517,7 @@ void QLineEdit::mousePressEvent(QMouseEvent* e)
mark = mark && (d->imHints & Qt::ImhNoPredictiveText); mark = mark && (d->imHints & Qt::ImhNoPredictiveText);
#endif // Q_OS_ANDROID #endif // Q_OS_ANDROID
int cursor = d->xToPos(e->pos().x()); int cursor = d->xToPos(e->pos().x());
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (!mark && d->dragEnabled && d->control->echoMode() == Normal && if (!mark && d->dragEnabled && d->control->echoMode() == Normal &&
e->button() == Qt::LeftButton && d->inSelection(e->pos().x())) { e->button() == Qt::LeftButton && d->inSelection(e->pos().x())) {
if (!d->dndTimer.isActive()) if (!d->dndTimer.isActive())
@ -1534,7 +1536,7 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e)
Q_D(QLineEdit); Q_D(QLineEdit);
if (e->buttons() & Qt::LeftButton) { if (e->buttons() & Qt::LeftButton) {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (d->dndTimer.isActive()) { if (d->dndTimer.isActive()) {
if ((d->mousePressPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) if ((d->mousePressPos - e->pos()).manhattanLength() > QApplication::startDragDistance())
d->drag(); d->drag();
@ -1581,7 +1583,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e)
Q_D(QLineEdit); Q_D(QLineEdit);
if (d->sendMouseEventToInputContext(e)) if (d->sendMouseEventToInputContext(e))
return; return;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (e->button() == Qt::LeftButton) { if (e->button() == Qt::LeftButton) {
if (d->dndTimer.isActive()) { if (d->dndTimer.isActive()) {
d->dndTimer.stop(); d->dndTimer.stop();
@ -2031,7 +2033,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*!\reimp /*!\reimp
*/ */
void QLineEdit::dragMoveEvent(QDragMoveEvent *e) void QLineEdit::dragMoveEvent(QDragMoveEvent *e)
@ -2096,7 +2098,7 @@ void QLineEdit::dropEvent(QDropEvent* e)
} }
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
/*! /*!

View File

@ -217,7 +217,7 @@ protected:
void focusInEvent(QFocusEvent *) override; void focusInEvent(QFocusEvent *) override;
void focusOutEvent(QFocusEvent *) override; void focusOutEvent(QFocusEvent *) override;
void paintEvent(QPaintEvent *) override; void paintEvent(QPaintEvent *) override;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *) override; void dragEnterEvent(QDragEnterEvent *) override;
void dragMoveEvent(QDragMoveEvent *e) override; void dragMoveEvent(QDragMoveEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override;

View File

@ -44,7 +44,9 @@
#if QT_CONFIG(itemviews) #if QT_CONFIG(itemviews)
#include "qabstractitemview.h" #include "qabstractitemview.h"
#endif #endif
#if QT_CONFIG(draganddrop)
#include "qdrag.h" #include "qdrag.h"
#endif
#include "qwidgetaction.h" #include "qwidgetaction.h"
#include "qclipboard.h" #include "qclipboard.h"
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
@ -310,7 +312,7 @@ bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
return false; return false;
} }
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
void QLineEditPrivate::drag() void QLineEditPrivate::drag()
{ {
Q_Q(QLineEdit); Q_Q(QLineEdit);
@ -323,8 +325,7 @@ void QLineEditPrivate::drag()
if (action == Qt::MoveAction && !control->isReadOnly() && drag->target() != q) if (action == Qt::MoveAction && !control->isReadOnly() && drag->target() != q)
control->removeSelection(); control->removeSelection();
} }
#endif // QT_CONFIG(draganddrop)
#endif // QT_NO_DRAGANDDROP
#if QT_CONFIG(toolbutton) #if QT_CONFIG(toolbutton)

View File

@ -211,7 +211,7 @@ public:
void _q_completionHighlighted(const QString &); void _q_completionHighlighted(const QString &);
#endif #endif
QPoint mousePressPos; QPoint mousePressPos;
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QBasicTimer dndTimer; QBasicTimer dndTimer;
void drag(); void drag();
#endif #endif

View File

@ -44,7 +44,9 @@
#include <qpainter.h> #include <qpainter.h>
#include <qevent.h> #include <qevent.h>
#include <qdebug.h> #include <qdebug.h>
#if QT_CONFIG(draganddrop)
#include <qdrag.h> #include <qdrag.h>
#endif
#include <qclipboard.h> #include <qclipboard.h>
#if QT_CONFIG(menu) #if QT_CONFIG(menu)
#include <qmenu.h> #include <qmenu.h>
@ -2139,7 +2141,7 @@ void QPlainTextEdit::contextMenuEvent(QContextMenuEvent *e)
} }
#endif // QT_NO_CONTEXTMENU #endif // QT_NO_CONTEXTMENU
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! \reimp /*! \reimp
*/ */
void QPlainTextEdit::dragEnterEvent(QDragEnterEvent *e) void QPlainTextEdit::dragEnterEvent(QDragEnterEvent *e)
@ -2180,7 +2182,7 @@ void QPlainTextEdit::dropEvent(QDropEvent *e)
d->sendControlEvent(e); d->sendControlEvent(e);
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! \reimp /*! \reimp
*/ */

View File

@ -247,7 +247,7 @@ protected:
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
virtual void contextMenuEvent(QContextMenuEvent *e) override; virtual void contextMenuEvent(QContextMenuEvent *e) override;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual void dragEnterEvent(QDragEnterEvent *e) override; virtual void dragEnterEvent(QDragEnterEvent *e) override;
virtual void dragLeaveEvent(QDragLeaveEvent *e) override; virtual void dragLeaveEvent(QDragLeaveEvent *e) override;
virtual void dragMoveEvent(QDragMoveEvent *e) override; virtual void dragMoveEvent(QDragMoveEvent *e) override;

View File

@ -1668,7 +1668,7 @@ bool QTabBar::event(QEvent *event)
d->updateMacBorderMetrics(); d->updateMacBorderMetrics();
return QWidget::event(event); return QWidget::event(event);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
} else if (event->type() == QEvent::DragEnter) { } else if (event->type() == QEvent::DragEnter) {
if (d->changeCurrentOnDrag) if (d->changeCurrentOnDrag)
event->accept(); event->accept();

View File

@ -49,7 +49,9 @@
#include <qpainter.h> #include <qpainter.h>
#include <qevent.h> #include <qevent.h>
#include <qdebug.h> #include <qdebug.h>
#if QT_CONFIG(draganddrop)
#include <qdrag.h> #include <qdrag.h>
#endif
#include <qclipboard.h> #include <qclipboard.h>
#if QT_CONFIG(menu) #if QT_CONFIG(menu)
#include <qmenu.h> #include <qmenu.h>
@ -1648,7 +1650,7 @@ void QTextEdit::contextMenuEvent(QContextMenuEvent *e)
} }
#endif // QT_NO_CONTEXTMENU #endif // QT_NO_CONTEXTMENU
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
/*! \reimp /*! \reimp
*/ */
void QTextEdit::dragEnterEvent(QDragEnterEvent *e) void QTextEdit::dragEnterEvent(QDragEnterEvent *e)
@ -1689,7 +1691,7 @@ void QTextEdit::dropEvent(QDropEvent *e)
d->sendControlEvent(e); d->sendControlEvent(e);
} }
#endif // QT_NO_DRAGANDDROP #endif // QT_CONFIG(draganddrop)
/*! \reimp /*! \reimp
*/ */

View File

@ -284,7 +284,7 @@ protected:
#ifndef QT_NO_CONTEXTMENU #ifndef QT_NO_CONTEXTMENU
virtual void contextMenuEvent(QContextMenuEvent *e) override; virtual void contextMenuEvent(QContextMenuEvent *e) override;
#endif #endif
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
virtual void dragEnterEvent(QDragEnterEvent *e) override; virtual void dragEnterEvent(QDragEnterEvent *e) override;
virtual void dragLeaveEvent(QDragLeaveEvent *e) override; virtual void dragLeaveEvent(QDragLeaveEvent *e) override;
virtual void dragMoveEvent(QDragMoveEvent *e) override; virtual void dragMoveEvent(QDragMoveEvent *e) override;

View File

@ -46,7 +46,9 @@
#include <qpainter.h> #include <qpainter.h>
#include <qevent.h> #include <qevent.h>
#include <qdebug.h> #include <qdebug.h>
#if QT_CONFIG(draganddrop)
#include <qdrag.h> #include <qdrag.h>
#endif
#include <qclipboard.h> #include <qclipboard.h>
#if QT_CONFIG(menu) #if QT_CONFIG(menu)
#include <qmenu.h> #include <qmenu.h>
@ -129,7 +131,7 @@ QWidgetTextControlPrivate::QWidgetTextControlPrivate()
interactionFlags(Qt::TextEditable | Qt::TextSelectableByKeyboard), interactionFlags(Qt::TextEditable | Qt::TextSelectableByKeyboard),
#endif #endif
dragEnabled(true), dragEnabled(true),
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
mousePressed(false), mightStartDrag(false), mousePressed(false), mightStartDrag(false),
#endif #endif
lastSelectionPosition(0), lastSelectionAnchor(0), lastSelectionPosition(0), lastSelectionAnchor(0),
@ -514,7 +516,7 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString
void QWidgetTextControlPrivate::startDrag() void QWidgetTextControlPrivate::startDrag()
{ {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
Q_Q(QWidgetTextControl); Q_Q(QWidgetTextControl);
mousePressed = false; mousePressed = false;
if (!contextWidget) if (!contextWidget)
@ -1066,7 +1068,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
} }
#endif // QT_NO_TOOLTIP #endif // QT_NO_TOOLTIP
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
case QEvent::DragEnter: { case QEvent::DragEnter: {
QDragEnterEvent *ev = static_cast<QDragEnterEvent *>(e); QDragEnterEvent *ev = static_cast<QDragEnterEvent *>(e);
if (d->dragEnterEvent(e, ev->mimeData())) if (d->dragEnterEvent(e, ev->mimeData()))
@ -1545,7 +1547,7 @@ void QWidgetTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton butto
mousePressPos = pos.toPoint(); mousePressPos = pos.toPoint();
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
mightStartDrag = false; mightStartDrag = false;
#endif #endif
@ -1615,7 +1617,7 @@ void QWidgetTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton butto
&& cursorPos >= cursor.selectionStart() && cursorPos >= cursor.selectionStart()
&& cursorPos <= cursor.selectionEnd() && cursorPos <= cursor.selectionEnd()
&& q->hitTest(pos, Qt::ExactHit) != -1) { && q->hitTest(pos, Qt::ExactHit) != -1) {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
mightStartDrag = true; mightStartDrag = true;
#endif #endif
return; return;
@ -1744,7 +1746,7 @@ void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton but
const int oldCursorPos = cursor.position(); const int oldCursorPos = cursor.position();
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
if (mightStartDrag && (button & Qt::LeftButton)) { if (mightStartDrag && (button & Qt::LeftButton)) {
mousePressed = false; mousePressed = false;
setCursorPosition(pos); setCursorPosition(pos);
@ -1807,7 +1809,7 @@ void QWidgetTextControlPrivate::mouseDoubleClickEvent(QEvent *e, Qt::MouseButton
if (button == Qt::LeftButton if (button == Qt::LeftButton
&& (interactionFlags & Qt::TextSelectableByMouse)) { && (interactionFlags & Qt::TextSelectableByMouse)) {
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
mightStartDrag = false; mightStartDrag = false;
#endif #endif
commitPreedit(); commitPreedit();

View File

@ -256,7 +256,7 @@ void tst_QStandardItem::getSetFlags()
item.setAutoTristate(true); item.setAutoTristate(true);
QVERIFY(item.isAutoTristate()); QVERIFY(item.isAutoTristate());
QVERIFY(item.flags() & Qt::ItemIsAutoTristate); QVERIFY(item.flags() & Qt::ItemIsAutoTristate);
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
item.setDragEnabled(true); item.setDragEnabled(true);
QVERIFY(item.isDragEnabled()); QVERIFY(item.isDragEnabled());
QVERIFY(item.flags() & Qt::ItemIsDragEnabled); QVERIFY(item.flags() & Qt::ItemIsDragEnabled);
@ -287,7 +287,7 @@ void tst_QStandardItem::getSetFlags()
item.setAutoTristate(false); item.setAutoTristate(false);
QVERIFY(!item.isAutoTristate()); QVERIFY(!item.isAutoTristate());
QVERIFY(!(item.flags() & Qt::ItemIsAutoTristate)); QVERIFY(!(item.flags() & Qt::ItemIsAutoTristate));
#ifndef QT_NO_DRAGANDDROP #if QT_CONFIG(draganddrop)
QVERIFY(item.isDragEnabled()); QVERIFY(item.isDragEnabled());
item.setDragEnabled(false); item.setDragEnabled(false);
QVERIFY(!item.isDragEnabled()); QVERIFY(!item.isDragEnabled());

Some files were not shown because too many files have changed in this diff Show More