From a16b6e29e0913f71c282adbc2b9f4ad83626c094 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 17 Feb 2017 12:40:56 +0100 Subject: Fix build with -no-feature-draganddrop Change-Id: If537cb6b7d41b2d6511c369451dde2e9289f724d Reviewed-by: Lars Knoll --- src/widgets/graphicsview/qgraphicsview.cpp | 19 ++----------------- src/widgets/graphicsview/qgraphicsview.h | 2 ++ src/widgets/itemviews/qlistview.cpp | 2 ++ src/widgets/itemviews/qlistwidget.h | 3 ++- src/widgets/itemviews/qtablewidget.h | 3 ++- src/widgets/itemviews/qtreewidget.h | 3 ++- 6 files changed, 12 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp index 41f5eddd99..9d7412340f 100644 --- a/src/widgets/graphicsview/qgraphicsview.cpp +++ b/src/widgets/graphicsview/qgraphicsview.cpp @@ -2996,12 +2996,12 @@ void QGraphicsView::contextMenuEvent(QContextMenuEvent *event) } #endif // QT_NO_CONTEXTMENU +#if QT_CONFIG(draganddrop) /*! \reimp */ void QGraphicsView::dropEvent(QDropEvent *event) { -#ifndef QT_NO_DRAGANDDROP Q_D(QGraphicsView); if (!d->scene || !d->sceneInteractionAllowed) return; @@ -3020,10 +3020,6 @@ void QGraphicsView::dropEvent(QDropEvent *event) delete d->lastDragDropEvent; d->lastDragDropEvent = 0; - -#else - Q_UNUSED(event) -#endif } /*! @@ -3031,7 +3027,6 @@ void QGraphicsView::dropEvent(QDropEvent *event) */ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event) { -#ifndef QT_NO_DRAGANDDROP Q_D(QGraphicsView); if (!d->scene || !d->sceneInteractionAllowed) return; @@ -3054,9 +3049,6 @@ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event) event->setAccepted(true); event->setDropAction(sceneEvent.dropAction()); } -#else - Q_UNUSED(event) -#endif } /*! @@ -3064,7 +3056,6 @@ void QGraphicsView::dragEnterEvent(QDragEnterEvent *event) */ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) { -#ifndef QT_NO_DRAGANDDROP Q_D(QGraphicsView); if (!d->scene || !d->sceneInteractionAllowed) return; @@ -3094,9 +3085,6 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) // Accept the originating event if the scene accepted the scene event. if (sceneEvent.isAccepted()) event->setAccepted(true); -#else - Q_UNUSED(event) -#endif } /*! @@ -3104,7 +3092,6 @@ void QGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) */ void QGraphicsView::dragMoveEvent(QDragMoveEvent *event) { -#ifndef QT_NO_DRAGANDDROP Q_D(QGraphicsView); if (!d->scene || !d->sceneInteractionAllowed) return; @@ -3123,10 +3110,8 @@ void QGraphicsView::dragMoveEvent(QDragMoveEvent *event) event->setAccepted(sceneEvent.isAccepted()); if (sceneEvent.isAccepted()) event->setDropAction(sceneEvent.dropAction()); -#else - Q_UNUSED(event) -#endif } +#endif // QT_CONFIG(draganddrop) /*! \reimp diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 327a75c374..64d5f5b430 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -244,10 +244,12 @@ protected: #ifndef QT_NO_CONTEXTMENU void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE; #endif +#if QT_CONFIG(draganddrop) void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE; void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE; void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE; void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; +#endif void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE; bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE; void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE; diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 45c547d313..1414823e82 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -2020,7 +2020,9 @@ int QCommonListViewBase::horizontalScrollToValue(const int /*index*/, QListView: QListModeViewBase::QListModeViewBase(QListView *q, QListViewPrivate *d) : QCommonListViewBase(q, d) { +#if QT_CONFIG(draganddrop) dd->defaultDropAction = Qt::CopyAction; +#endif } #ifndef QT_NO_DRAGANDDROP diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h index c70e0522b7..85ca639e50 100644 --- a/src/widgets/itemviews/qlistwidget.h +++ b/src/widgets/itemviews/qlistwidget.h @@ -252,8 +252,9 @@ public: bool isItemHidden(const QListWidgetItem *item) const; void setItemHidden(const QListWidgetItem *item, bool hide); +#if QT_CONFIG(draganddrop) void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; - +#endif public Q_SLOTS: void scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint = EnsureVisible); void clear(); diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h index 5dde93f628..b91bcf7ce4 100644 --- a/src/widgets/itemviews/qtablewidget.h +++ b/src/widgets/itemviews/qtablewidget.h @@ -331,8 +331,9 @@ protected: QModelIndex indexFromItem(QTableWidgetItem *item) const; QTableWidgetItem *itemFromIndex(const QModelIndex &index) const; +#if QT_CONFIG(draganddrop) void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; - +#endif private: void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h index 36ba9985bd..fc0bccf2fe 100644 --- a/src/widgets/itemviews/qtreewidget.h +++ b/src/widgets/itemviews/qtreewidget.h @@ -360,8 +360,9 @@ protected: QModelIndex indexFromItem(const QTreeWidgetItem *item, int column = 0) const; QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const; // ### Qt 6: remove QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const; +#if QT_CONFIG(draganddrop) void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; - +#endif private: void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; -- cgit v1.2.3