From 9f27bfb31acfba49a74a342d9249f24633a7ade2 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 13 Apr 2018 09:01:43 +0200 Subject: 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 --- src/widgets/dialogs/qcolordialog.cpp | 20 +++++++++++--------- src/widgets/dialogs/qfiledialog.cpp | 4 ++-- src/widgets/dialogs/qsidebar.cpp | 10 +++++----- src/widgets/dialogs/qsidebar_p.h | 4 ++-- 4 files changed, 20 insertions(+), 18 deletions(-) (limited to 'src/widgets/dialogs') diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index cf1119254b..99946d341d 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -45,7 +45,9 @@ #include "qdrawutil.h" #include "qevent.h" #include "qimage.h" -#include "qdrag.h" +#if QT_CONFIG(draganddrop) +#include +#endif #include "qlabel.h" #include "qlayout.h" #include "qlineedit.h" @@ -592,7 +594,7 @@ protected: void mousePressEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void dragEnterEvent(QDragEnterEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override; void dragMoveEvent(QDragMoveEvent *e) override; @@ -624,7 +626,7 @@ void QColorWell::mousePressEvent(QMouseEvent *e) void QColorWell::mouseMoveEvent(QMouseEvent *e) { QWellArray::mouseMoveEvent(e); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) if (!mousePressed) return; if ((pressPos - e->pos()).manhattanLength() > QApplication::startDragDistance()) { @@ -647,7 +649,7 @@ void QColorWell::mouseMoveEvent(QMouseEvent *e) #endif } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void QColorWell::dragEnterEvent(QDragEnterEvent *e) { if (qvariant_cast(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) { @@ -1072,7 +1074,7 @@ protected: void mousePressEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void dragEnterEvent(QDragEnterEvent *e) override; void dragLeaveEvent(QDragLeaveEvent *e) override; void dropEvent(QDropEvent *e) override; @@ -1110,7 +1112,7 @@ void QColorShowLabel::mousePressEvent(QMouseEvent *e) void QColorShowLabel::mouseMoveEvent(QMouseEvent *e) { -#ifdef QT_NO_DRAGANDDROP +#if !QT_CONFIG(draganddrop) Q_UNUSED(e); #else if (!mousePressed) @@ -1132,7 +1134,7 @@ void QColorShowLabel::mouseMoveEvent(QMouseEvent *e) #endif } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void QColorShowLabel::dragEnterEvent(QDragEnterEvent *e) { if (qvariant_cast(e->mimeData()->colorData()).isValid()) @@ -1157,7 +1159,7 @@ void QColorShowLabel::dropEvent(QDropEvent *e) e->ignore(); } } -#endif // QT_NO_DRAGANDDROP +#endif // QT_CONFIG(draganddrop) void QColorShowLabel::mouseReleaseEvent(QMouseEvent *) { diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 3d91bdef34..5d8ca458c2 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -3945,7 +3945,7 @@ void QFileDialogListView::setFileDialogPrivate(QFileDialogPrivate *d_pointer) setResizeMode(QListView::Adjust); setEditTriggers(QAbstractItemView::EditKeyPressed); setContextMenuPolicy(Qt::CustomContextMenu); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) setDragDropMode(QAbstractItemView::InternalMove); #endif } @@ -3986,7 +3986,7 @@ void QFileDialogTreeView::setFileDialogPrivate(QFileDialogPrivate *d_pointer) setTextElideMode(Qt::ElideMiddle); setEditTriggers(QAbstractItemView::EditKeyPressed); setContextMenuPolicy(Qt::CustomContextMenu); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) setDragDropMode(QAbstractItemView::InternalMove); #endif } diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp index f77b10ecbc..d52f18b406 100644 --- a/src/widgets/dialogs/qsidebar.cpp +++ b/src/widgets/dialogs/qsidebar.cpp @@ -118,7 +118,7 @@ QMimeData *QUrlModel::mimeData(const QModelIndexList &indexes) const return data; } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) /*! 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; } -#endif // QT_NO_DRAGANDDROP +#endif // QT_CONFIG(draganddrop) /*! \reimp @@ -391,7 +391,7 @@ void QSidebar::setModelAndUrls(QFileSystemModel *model, const QList &newUr connect(selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(clicked(QModelIndex))); -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) setDragDropMode(QAbstractItemView::DragDrop); #endif setContextMenuPolicy(Qt::CustomContextMenu); @@ -405,13 +405,13 @@ QSidebar::~QSidebar() { } -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void QSidebar::dragEnterEvent(QDragEnterEvent *event) { if (urlModel->canDrop(event)) QListView::dragEnterEvent(event); } -#endif // QT_NO_DRAGANDDROP +#endif // QT_CONFIG(draganddrop) QSize QSidebar::sizeHint() const { diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h index 07aaa5abd2..4a82f88878 100644 --- a/src/widgets/dialogs/qsidebar_p.h +++ b/src/widgets/dialogs/qsidebar_p.h @@ -86,7 +86,7 @@ public: QStringList mimeTypes() const override; QMimeData *mimeData(const QModelIndexList &indexes) const override; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) bool canDrop(QDragEnterEvent *event); bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; #endif @@ -142,7 +142,7 @@ public: protected: bool event(QEvent * e) override; void focusInEvent(QFocusEvent *event) override; -#ifndef QT_NO_DRAGANDDROP +#if QT_CONFIG(draganddrop) void dragEnterEvent(QDragEnterEvent *event) override; #endif -- cgit v1.2.3