summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp20
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp4
-rw-r--r--src/widgets/dialogs/qsidebar.cpp10
-rw-r--r--src/widgets/dialogs/qsidebar_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp10
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp6
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp30
-rw-r--r--src/widgets/itemviews/qabstractitemview.h10
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h6
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp2
-rw-r--r--src/widgets/itemviews/qlistview.cpp24
-rw-r--r--src/widgets/itemviews/qlistview.h4
-rw-r--r--src/widgets/itemviews/qlistview_p.h8
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp8
-rw-r--r--src/widgets/itemviews/qlistwidget.h2
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h2
-rw-r--r--src/widgets/itemviews/qtableview.cpp2
-rw-r--r--src/widgets/itemviews/qtableview_p.h2
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp4
-rw-r--r--src/widgets/itemviews/qtreeview.cpp4
-rw-r--r--src/widgets/itemviews/qtreeview.h2
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/kernel/qapplication.cpp12
-rw-r--r--src/widgets/kernel/qapplication_p.h4
-rw-r--r--src/widgets/kernel/qwidget.cpp40
-rw-r--r--src/widgets/kernel/qwidget.h2
-rw-r--r--src/widgets/kernel/qwidget_p.h4
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp6
-rw-r--r--src/widgets/kernel/qwidgetwindow_p.h4
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp2
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp2
-rw-r--r--src/widgets/util/qcompleter.cpp1
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp6
-rw-r--r--src/widgets/widgets/qabstractscrollarea.h2
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp6
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp2
-rw-r--r--src/widgets/widgets/qlineedit.cpp16
-rw-r--r--src/widgets/widgets/qlineedit.h2
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp7
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp6
-rw-r--r--src/widgets/widgets/qplaintextedit.h2
-rw-r--r--src/widgets/widgets/qtabbar.cpp2
-rw-r--r--src/widgets/widgets/qtextedit.cpp6
-rw-r--r--src/widgets/widgets/qtextedit.h2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp16
48 files changed, 175 insertions, 149 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index fdbcdd12e9..e6a8ec47a4 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 <qdrag.h>
+#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<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)
{
@@ -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<QColor>(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 ef369349b2..8248676a9f 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<QUrl> &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
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index 442f08325d..177dbc4871 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -1050,13 +1050,13 @@ void QGraphicsProxyWidget::contextMenuEvent(QGraphicsSceneContextMenuEvent *even
}
#endif // QT_NO_CONTEXTMENU
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
\reimp
*/
void QGraphicsProxyWidget::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
-#ifdef QT_NO_DRAGANDDROP
+#if !QT_CONFIG(draganddrop)
Q_UNUSED(event);
#else
Q_D(QGraphicsProxyWidget);
@@ -1077,7 +1077,7 @@ void QGraphicsProxyWidget::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
{
Q_UNUSED(event);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
Q_D(QGraphicsProxyWidget);
if (!d->widget || !d->dragDropWidget)
return;
@@ -1092,7 +1092,7 @@ void QGraphicsProxyWidget::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
*/
void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
{
-#ifdef QT_NO_DRAGANDDROP
+#if !QT_CONFIG(draganddrop)
Q_UNUSED(event);
#else
Q_D(QGraphicsProxyWidget);
@@ -1158,7 +1158,7 @@ void QGraphicsProxyWidget::dragMoveEvent(QGraphicsSceneDragDropEvent *event)
*/
void QGraphicsProxyWidget::dropEvent(QGraphicsSceneDragDropEvent *event)
{
-#ifdef QT_NO_DRAGANDDROP
+#if !QT_CONFIG(draganddrop)
Q_UNUSED(event);
#else
Q_D(QGraphicsProxyWidget);
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h
index 76fdf8aeba..aa51500ecb 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.h
@@ -85,7 +85,7 @@ protected:
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 1320545748..24647dd74c 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -850,7 +850,7 @@ void QGraphicsViewPrivate::storeDragDropEvent(const QGraphicsSceneDragDropEvent
void QGraphicsViewPrivate::populateSceneDragDropEvent(QGraphicsSceneDragDropEvent *dest,
QDropEvent *source)
{
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
Q_Q(QGraphicsView);
dest->setScenePos(q->mapToScene(source->pos()));
dest->setScreenPos(q->mapToGlobal(source->pos()));
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 117de8edf9..c9f321c3f6 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -63,9 +63,11 @@
#include <private/qabstractitemdelegate_p.h>
#include <qpa/qplatformintegration.h>
+#if QT_CONFIG(draganddrop)
#include <qpa/qplatformdrag.h>
-#include <private/qguiapplication_p.h>
#include <private/qdnd_p.h>
+#endif
+#include <private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -515,7 +517,7 @@ bool QAbstractItemDelegatePrivate::editorEventFilter(QObject *object, QEvent *ev
return false;
w = w->parentWidget();
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
// The window may lose focus during an drag operation.
// i.e when dragging involves the taskbar on Windows.
QPlatformDrag *platformDrag = QGuiApplicationPrivate::instance()->platformIntegration()->drag();
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index a07297863d..02eae33a12 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -44,7 +44,9 @@
#include <qclipboard.h>
#include <qpainter.h>
#include <qstyle.h>
+#if QT_CONFIG(draganddrop)
#include <qdrag.h>
+#endif
#include <qevent.h>
#include <qscrollbar.h>
#include <qtooltip.h>
@@ -90,7 +92,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
editTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed),
lastTrigger(QAbstractItemView::NoEditTriggers),
tabKeyNavigation(false),
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
showDropIndicator(true),
dragEnabled(false),
dragDropMode(QAbstractItemView::NoDragDrop),
@@ -1325,7 +1327,7 @@ void QAbstractItemView::resetHorizontalScrollMode()
d_func()->horizontalScrollModeSet = false;
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
\since 4.2
\property QAbstractItemView::dragDropOverwriteMode
@@ -1432,7 +1434,7 @@ QSize QAbstractItemView::viewportSizeHint() const
return QAbstractScrollArea::viewportSizeHint();
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
\property QAbstractItemView::showDropIndicator
\brief whether the drop indicator is shown when dragging items and dropping.
@@ -1551,7 +1553,7 @@ Qt::DropAction QAbstractItemView::defaultDropAction() const
return d->defaultDropAction;
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
/*!
\property QAbstractItemView::alternatingRowColors
@@ -1828,7 +1830,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
if (state() == ExpandingState || state() == CollapsingState)
return;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (state() == DraggingState) {
topLeft = d->pressedPosition - d->offset();
if ((topLeft - bottomRight).manhattanLength() > QApplication::startDragDistance()) {
@@ -1839,7 +1841,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
}
return;
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
QPersistentModelIndex index = indexAt(bottomRight);
QModelIndex buddy = d->model->buddy(d->pressedIndex);
@@ -1854,7 +1856,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
d->checkMouseMove(index);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (d->pressedIndex.isValid()
&& d->dragEnabled
&& (state() != DragSelectingState)
@@ -1962,7 +1964,7 @@ void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event)
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
@@ -2216,7 +2218,7 @@ QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, const Q
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.
@@ -2567,7 +2569,7 @@ void QAbstractItemView::inputMethodEvent(QInputMethodEvent *event)
}
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
\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)));
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
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;
}
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
/*!
Returns a QStyleOptionViewItem structure populated with the view's
@@ -3911,7 +3913,7 @@ void QAbstractItemView::doAutoScroll()
if (verticalUnchanged && horizontalUnchanged) {
stopAutoScroll();
} else {
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
d->dropIndicatorRect = QRect();
d->dropIndicatorPosition = QAbstractItemView::OnViewport;
#endif
@@ -4286,7 +4288,7 @@ void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QMo
*/
void QAbstractItemViewPrivate::clearOrRemove()
{
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
const QItemSelection selection = selectionModel->selection();
QList<QItemSelectionRange>::const_iterator it = selection.constBegin();
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 8a138bdb67..981582c166 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -65,7 +65,7 @@ class Q_WIDGETS_EXPORT QAbstractItemView : public QAbstractScrollArea
Q_PROPERTY(int autoScrollMargin READ autoScrollMargin WRITE setAutoScrollMargin)
Q_PROPERTY(EditTriggers editTriggers READ editTriggers WRITE setEditTriggers)
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 dragEnabled READ dragEnabled WRITE setDragEnabled)
Q_PROPERTY(bool dragDropOverwriteMode READ dragDropOverwriteMode WRITE setDragDropOverwriteMode)
@@ -165,7 +165,7 @@ public:
void setTabKeyNavigation(bool enable);
bool tabKeyNavigation() const;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void setDropIndicatorShown(bool enable);
bool showDropIndicator() const;
@@ -297,7 +297,7 @@ protected:
virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index,
const QEvent *event = nullptr) const;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
virtual void startDrag(Qt::DropActions supportedActions);
#endif
@@ -334,7 +334,7 @@ protected:
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *event) override;
void dragMoveEvent(QDragMoveEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
@@ -348,7 +348,7 @@ protected:
void inputMethodEvent(QInputMethodEvent *event) override;
bool eventFilter(QObject *object, QEvent *event) override;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
enum DropIndicatorPosition { OnItem, AboveItem, BelowItem, OnViewport };
DropIndicatorPosition dropIndicatorPosition() const;
#endif
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index d8af96af55..fe1c00248f 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -130,7 +130,7 @@ public:
}
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);
#endif
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;
inline bool canDrop(QDropEvent *event) {
@@ -400,7 +400,7 @@ public:
bool tabKeyNavigation;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
bool showDropIndicator;
QRect dropIndicatorRect;
bool dragEnabled;
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index d94f25de78..5100d2a427 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -772,7 +772,7 @@ void QColumnView::initializeColumn(QAbstractItemView *column) const
column->setMinimumWidth(100);
column->setAttribute(Qt::WA_MacShowFocusRect, false);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
column->setDragDropMode(dragDropMode());
column->setDragDropOverwriteMode(dragDropOverwriteMode());
column->setDropIndicatorShown(showDropIndicator());
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 504e45c2fd..05e3ebf664 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -44,7 +44,9 @@
#include <qapplication.h>
#include <qpainter.h>
#include <qbitmap.h>
+#if QT_CONFIG(draganddrop)
#include <qdrag.h>
+#endif
#include <qvector.h>
#include <qstyle.h>
#include <qevent.h>
@@ -230,7 +232,7 @@ void QListView::setMovement(Movement movement)
d->modeProperties |= uint(QListViewPrivate::Movement);
d->movement = movement;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
bool movable = (movement != Static);
setDragEnabled(movable);
d->viewport->setAcceptDrops(movable);
@@ -494,7 +496,7 @@ void QListView::setViewMode(ViewMode mode)
d->showElasticBand = true;
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
bool movable = (d->movement != Static);
setDragEnabled(movable);
setAcceptDrops(movable);
@@ -875,7 +877,7 @@ void QListView::resizeEvent(QResizeEvent *e)
}
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
\reimp
@@ -919,7 +921,7 @@ void QListView::startDrag(Qt::DropActions supportedActions)
QAbstractItemView::startDrag(supportedActions);
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
/*!
\reimp
@@ -1048,7 +1050,7 @@ void QListView::paintEvent(QPaintEvent *e)
d->delegateForIndex(*it)->paint(&painter, option, *it);
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
d->commonListView->paintDragDrop(&painter);
#endif
@@ -1829,7 +1831,7 @@ QItemSelection QListViewPrivate::selection(const QRect &rect) const
return selection;
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QAbstractItemView::DropIndicatorPosition QListViewPrivate::position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const
{
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()));
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void QCommonListViewBase::paintDragDrop(QPainter *painter)
{
// FIXME: Until the we can provide a proper drop indicator
@@ -2006,7 +2008,7 @@ QListModeViewBase::QListModeViewBase(QListView *q, QListViewPrivate *d)
#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 r = QAbstractItemView::OnViewport;
@@ -2165,7 +2167,7 @@ bool QListModeViewBase::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QM
return false;
}
-#endif //QT_NO_DRAGANDDROP
+#endif //QT_CONFIG(draganddrop)
void QListModeViewBase::updateVerticalScrollBar(const QSize &step)
{
@@ -2740,7 +2742,7 @@ void QIconModeViewBase::removeHiddenRow(int row)
tree.insertLeaf(items.at(row).rect(), row);
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions)
{
// This function does the same thing as in QAbstractItemView::startDrag(),
@@ -2862,7 +2864,7 @@ bool QIconModeViewBase::filterDragMoveEvent(QDragMoveEvent *e)
dd->startAutoScroll();
return true;
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
void QIconModeViewBase::setRowCount(int rowCount)
{
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index 2da510facf..9fc4035999 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -158,12 +158,12 @@ protected:
void timerEvent(QTimerEvent *e) override;
void resizeEvent(QResizeEvent *e) override;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void dragMoveEvent(QDragMoveEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *e) override;
void dropEvent(QDropEvent *e) override;
void startDrag(Qt::DropActions supportedActions) override;
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
QStyleOptionViewItem viewOptions() const override;
void paintEvent(QPaintEvent *e) override;
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 8d29767951..ca947292e3 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -143,7 +143,7 @@ public:
virtual void removeHiddenRow(int row);
virtual void setPositionForIndex(const QPoint &, const QModelIndex &) { }
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
virtual void paintDragDrop(QPainter *painter);
virtual bool filterDragMoveEvent(QDragMoveEvent *) { return false; }
virtual bool filterDragLeaveEvent(QDragLeaveEvent *) { return false; }
@@ -228,7 +228,7 @@ public:
void updateHorizontalScrollBar(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.
// WARNING: Plenty of duplicated code from QAbstractItemView{,Private}.
QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const;
@@ -274,7 +274,7 @@ public:
void removeHiddenRow(int row) override;
void setPositionForIndex(const QPoint &position, const QModelIndex &index) override;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
bool filterDragMoveEvent(QDragMoveEvent *) override;
bool filterDragLeaveEvent(QDragLeaveEvent *) override;
bool filterDropEvent(QDropEvent *e) override;
@@ -358,7 +358,7 @@ public:
QItemSelection selection(const QRect &rect) const;
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;
bool dropOn(QDropEvent *event, int *row, int *col, QModelIndex *index) override;
#endif
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 0faed6df47..72e0a67a64 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -441,7 +441,7 @@ QMimeData *QListModel::mimeData(const QModelIndexList &indexes) const
return mimeData;
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
bool QListModel::dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &index)
{
@@ -460,7 +460,7 @@ Qt::DropActions QListModel::supportedDropActions() const
const QListWidget *view = qobject_cast<const QListWidget*>(QObject::parent());
return view->supportedDropActions();
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
/*!
\class QListWidgetItem
@@ -1856,7 +1856,7 @@ QMimeData *QListWidget::mimeData(const QList<QListWidgetItem*> items) const
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
with the given \a action in the given \a index. Returns \c true if \a data and
@@ -1931,7 +1931,7 @@ Qt::DropActions QListWidget::supportedDropActions() const
Q_D(const QListWidget);
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
diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h
index 8a31411429..947fdb1a2f 100644
--- a/src/widgets/itemviews/qlistwidget.h
+++ b/src/widgets/itemviews/qlistwidget.h
@@ -286,7 +286,7 @@ protected:
#else
virtual QMimeData *mimeData(const QList<QListWidgetItem*> items) const;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
virtual bool dropMimeData(int index, const QMimeData *data, Qt::DropAction action);
virtual Qt::DropActions supportedDropActions() const;
#endif
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index 30b5016db6..9cb3d5966b 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -124,7 +124,7 @@ public:
// dnd
QStringList mimeTypes() 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,
int row, int column, const QModelIndex &parent) override;
Qt::DropActions supportedDropActions() const override;
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 313ef424a3..5ae1994559 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -1541,7 +1541,7 @@ void QTableView::paintEvent(QPaintEvent *event)
}
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
// Paint the dropIndicator
d->paintDropIndicator(&painter);
#endif
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index 1a0fef9017..805787597c 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -142,7 +142,7 @@ public:
visualCursor(QPoint())
{
wrapItemText = true;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
overwrite = true;
#endif
}
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index 07b8d3484e..11925af7a0 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -2626,7 +2626,7 @@ QMimeData *QTableWidget::mimeData(const QList<QTableWidgetItem*> items) const
bool QTableWidget::dropMimeData(int row, int column, const QMimeData *data, Qt::DropAction action)
{
QModelIndex idx;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (dropIndicatorPosition() == QAbstractItemView::OnItem) {
// QAbstractTableModel::dropMimeData will overwrite on the index if row == -1 and column == -1
idx = model()->index(row, column);
@@ -2709,7 +2709,7 @@ bool QTableWidget::event(QEvent *e)
return QTableView::event(e);
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*! \reimp */
void QTableWidget::dropEvent(QDropEvent *event) {
Q_D(QTableWidget);
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 8f7061f9d9..9a3c05ee38 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1278,7 +1278,7 @@ void QTreeView::timerEvent(QTimerEvent *event)
/*!
\reimp
*/
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void QTreeView::dragMoveEvent(QDragMoveEvent *event)
{
Q_D(QTreeView);
@@ -1333,7 +1333,7 @@ void QTreeView::paintEvent(QPaintEvent *event)
#endif //QT_NO_ANIMATION
{
drawTree(&painter, event->region());
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
d->paintDropIndicator(&painter);
#endif
}
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index e7ee55aa2a..09ce0e3fff 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -201,7 +201,7 @@ protected:
void mouseDoubleClickEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void dragMoveEvent(QDragMoveEvent *event) override;
#endif
bool viewportEvent(QEvent *event) override;
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 07907711d7..2578fa0958 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -3394,7 +3394,7 @@ QTreeWidgetItem *QTreeWidget::itemFromIndex(const QModelIndex &index) const
return d->item(index);
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*! \reimp */
void QTreeWidget::dropEvent(QDropEvent *event) {
Q_D(QTreeWidget);
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index c316c03a44..5dae8a7a0d 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -63,7 +63,9 @@
#include "qtranslator.h"
#include "qvariant.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 "qcolormap.h"
#include "qdebug.h"
@@ -832,7 +834,7 @@ QApplication::~QApplication()
delete QApplicationPrivate::app_style;
QApplicationPrivate::app_style = 0;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (qt_is_gui_used)
delete QDragManager::self();
#endif
@@ -3440,7 +3442,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
break;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::DragEnter: {
QWidget* w = static_cast<QWidget *>(receiver);
QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent *>(e);
@@ -4488,7 +4490,7 @@ void QApplicationPrivate::notifyThemeChanged()
qt_init_tooltip_palette();
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void QApplicationPrivate::notifyDragStarted(const QDrag *drag)
{
QGuiApplicationPrivate::notifyDragStarted(drag);
@@ -4499,7 +4501,7 @@ void QApplicationPrivate::notifyDragStarted(const QDrag *drag)
if (qt_button_down && !qt_button_down->inherits("QQuickWidget"))
qt_button_down = nullptr;
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
#ifndef QT_NO_GESTURES
QGestureManager* QGestureManager::instance()
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 21ba47caa3..2d9468cc21 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -177,9 +177,9 @@ public:
protected:
void notifyThemeChanged() override;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void notifyDragStarted(const QDrag *) override;
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
public:
static QFont *sys_font;
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 6b3fad6b5f..95d3da1ed4 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1322,7 +1322,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
<< "Alien?" << !testAttribute(Qt::WA_NativeWindow);
#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
// re-create the widget with a native window.
if (testAttribute(Qt::WA_WState_Created) && !internalWinId() && testAttribute(Qt::WA_NativeWindow)
@@ -5574,21 +5574,23 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (renderToTexture) {
// This widget renders into a texture which is composed later. We just need to
// punch a hole in the backingstore, so the texture will be visible.
- if (!q->testAttribute(Qt::WA_AlwaysStackOnTop)) {
- beginBackingStorePainting();
- if (backingStore) {
- QPainter p(q);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- p.fillRect(q->rect(), Qt::transparent);
- } else {
- QImage img = grabFramebuffer();
- QPainter p(q);
- // We are not drawing to a backingstore: fall back to QImage
- p.drawImage(q->rect(), img);
- skipPaintEvent = true;
- }
- endBackingStorePainting();
+ beginBackingStorePainting();
+ if (!q->testAttribute(Qt::WA_AlwaysStackOnTop) && backingStore) {
+ QPainter p(q);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ p.fillRect(q->rect(), Qt::transparent);
+ } else if (!backingStore) {
+ // We are not drawing to a backingstore: fall back to QImage
+ QImage img = grabFramebuffer();
+ // grabFramebuffer() always sets the format to RGB32
+ // regardless of whether it is transparent or not.
+ if (img.format() == QImage::Format_RGB32)
+ img.reinterpretAsFormat(QImage::Format_ARGB32_Premultiplied);
+ QPainter p(q);
+ p.drawImage(q->rect(), img);
+ skipPaintEvent = true;
}
+ endBackingStorePainting();
if (renderToTextureReallyDirty)
renderToTextureReallyDirty = 0;
else
@@ -9075,7 +9077,7 @@ bool QWidget::event(QEvent *event)
break;
#endif // QT_NO_CONTEXTMENU
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::Drop:
dropEvent((QDropEvent*) event);
break;
@@ -9957,7 +9959,7 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints)
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
\fn void QWidget::dragEnterEvent(QDragEnterEvent *event)
@@ -10026,7 +10028,7 @@ void QWidget::dropEvent(QDropEvent *)
{
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
/*!
\fn void QWidget::showEvent(QShowEvent *event)
@@ -11175,7 +11177,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
switch (attribute) {
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case Qt::WA_AcceptDrops: {
if (on && !testAttribute(Qt::WA_DropSiteRegistered))
setAttribute(Qt::WA_DropSiteRegistered, true);
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 5087d330ee..9f9f167002 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -636,7 +636,7 @@ protected:
virtual void actionEvent(QActionEvent *event);
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
virtual void dragEnterEvent(QDragEnterEvent *event);
virtual void dragMoveEvent(QDragMoveEvent *event);
virtual void dragLeaveEvent(QDragLeaveEvent *event);
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index fae9e5ff4e..20c4a682ed 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -268,7 +268,7 @@ struct QWExtra {
// *************************** Platform specific values (bit fields first) **********
#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
QList<QPointer<QWidget> > oleDropWidgets;
#endif
@@ -800,7 +800,7 @@ public:
bool shouldShowMaximizeButton();
void winUpdateIsOpaque();
void reparentChildren();
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QOleDropTarget *registerOleDnd(QWidget *widget);
void unregisterOleDnd(QWidget *widget, QOleDropTarget *target);
#endif
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index fd76c8b69e..5603c7cb20 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -309,7 +309,7 @@ bool QWidgetWindow::event(QEvent *event)
return true;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::DragEnter:
case QEvent::DragMove:
handleDragEnterMoveEvent(static_cast<QDragMoveEvent *>(event));
@@ -847,7 +847,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event)
#endif // QT_CONFIG(wheelevent)
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void QWidgetWindow::handleDragEnterMoveEvent(QDragMoveEvent *event)
{
@@ -923,7 +923,7 @@ void QWidgetWindow::handleDropEvent(QDropEvent *event)
m_dragTarget = 0;
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
{
diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h
index d0f1d55c2a..ead099390e 100644
--- a/src/widgets/kernel/qwidgetwindow_p.h
+++ b/src/widgets/kernel/qwidgetwindow_p.h
@@ -95,7 +95,7 @@ protected:
#if QT_CONFIG(wheelevent)
void handleWheelEvent(QWheelEvent *);
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void handleDragEnterMoveEvent(QDragMoveEvent *);
void handleDragLeaveEvent(QDragLeaveEvent *);
void handleDropEvent(QDropEvent *);
@@ -132,7 +132,7 @@ private:
QPointer<QWidget> m_widget;
QPointer<QWidget> m_implicit_mouse_grabber;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QPointer<QWidget> m_dragTarget;
#endif
};
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
index 097931913e..81916bba90 100644
--- a/src/widgets/kernel/qwindowcontainer.cpp
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -329,7 +329,7 @@ bool QWindowContainer::event(QEvent *e)
}
}
break;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::Drop:
case QEvent::DragMove:
case QEvent::DragLeave:
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index 130260704f..42691d6b77 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -136,7 +136,7 @@ static QEvent *cloneEvent(QEvent *e)
return new QEvent(*e);
case QEvent::DeferredDelete:
return new QEvent(*e);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::DragEnter:
return new QDragEnterEvent(*static_cast<QDragEnterEvent*>(e));
case QEvent::DragMove:
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 60421a56b7..96dde64ccc 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -162,6 +162,7 @@
#if QT_CONFIG(lineedit)
#include "QtWidgets/qlineedit.h"
#endif
+#include "QtCore/qdir.h"
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 917cddce6f..598d173144 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -1065,7 +1065,7 @@ bool QAbstractScrollArea::event(QEvent *e)
case QEvent::MouseButtonDblClick:
case QEvent::MouseMove:
case QEvent::Wheel:
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::Drop:
case QEvent::DragEnter:
case QEvent::DragMove:
@@ -1206,7 +1206,7 @@ bool QAbstractScrollArea::viewportEvent(QEvent *e)
#if QT_CONFIG(wheelevent)
case QEvent::Wheel:
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::Drop:
case QEvent::DragEnter:
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)
diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h
index 8a17036fb2..6d0d8fa6e6 100644
--- a/src/widgets/widgets/qabstractscrollarea.h
+++ b/src/widgets/widgets/qabstractscrollarea.h
@@ -122,7 +122,7 @@ protected:
#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *) override;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *) override;
void dragMoveEvent(QDragMoveEvent *) override;
void dragLeaveEvent(QDragLeaveEvent *) override;
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 71603ceb57..0459eadfff 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -625,6 +625,8 @@ void QAbstractSpinBox::stepDown()
function. Note that this function is called even if the resulting
value will be outside the bounds of minimum and maximum. It's this
function's job to handle these situations.
+
+ \sa stepUp(), stepDown(), keyPressEvent()
*/
void QAbstractSpinBox::stepBy(int steps)
@@ -987,6 +989,8 @@ void QAbstractSpinBox::paintEvent(QPaintEvent *)
\row \li Page down
\li This will invoke stepBy(-10)
\endtable
+
+ \sa stepBy()
*/
@@ -1688,7 +1692,7 @@ void QAbstractSpinBox::initStyleOption(QStyleOptionSpinBox *option) const
option->activeSubControls = QStyle::SC_None;
option->buttonSymbols = d->buttonSymbols;
option->subControls = QStyle::SC_SpinBoxEditField;
- if (!style()->styleHint(QStyle::SH_SpinBox_ButtonsInsideFrame, nullptr, this))
+ if (style()->styleHint(QStyle::SH_SpinBox_ButtonsInsideFrame, nullptr, this))
option->subControls |= QStyle::SC_SpinBoxFrame;
if (d->buttonSymbols != QAbstractSpinBox::NoButtons) {
option->subControls |= QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown;
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 059fb21295..9559b58339 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -1005,7 +1005,7 @@ Qt::DayOfWeek QCalendarModel::dayOfWeekForColumn(int column) const
int QCalendarModel::columnForDayOfWeek(Qt::DayOfWeek day) const
{
- if (day < 1 || day > 7)
+ if (day < 1 || unsigned(day) > unsigned(7))
return -1;
int column = (int)day - (int)m_firstDay;
if (column < 0)
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index bb1bf64ba0..27a94740ac 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -43,7 +43,9 @@
#include "qaction.h"
#include "qapplication.h"
#include "qclipboard.h"
-#include "qdrag.h"
+#if QT_CONFIG(draganddrop)
+#include <qdrag.h>
+#endif
#include "qdrawutil.h"
#include "qevent.h"
#include "qfontmetrics.h"
@@ -1427,7 +1429,7 @@ bool QLineEdit::event(QEvent * e)
// ### Qt6: move to timerEvent, is here for binary compatibility
int timerId = ((QTimerEvent*)e)->timerId();
if (false) {
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
} else if (timerId == d->dndTimer.timerId()) {
d->drag();
#endif
@@ -1515,7 +1517,7 @@ void QLineEdit::mousePressEvent(QMouseEvent* e)
mark = mark && (d->imHints & Qt::ImhNoPredictiveText);
#endif // Q_OS_ANDROID
int cursor = d->xToPos(e->pos().x());
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (!mark && d->dragEnabled && d->control->echoMode() == Normal &&
e->button() == Qt::LeftButton && d->inSelection(e->pos().x())) {
if (!d->dndTimer.isActive())
@@ -1534,7 +1536,7 @@ void QLineEdit::mouseMoveEvent(QMouseEvent * e)
Q_D(QLineEdit);
if (e->buttons() & Qt::LeftButton) {
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (d->dndTimer.isActive()) {
if ((d->mousePressPos - e->pos()).manhattanLength() > QApplication::startDragDistance())
d->drag();
@@ -1581,7 +1583,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e)
Q_D(QLineEdit);
if (d->sendMouseEventToInputContext(e))
return;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (e->button() == Qt::LeftButton) {
if (d->dndTimer.isActive()) {
d->dndTimer.stop();
@@ -2045,7 +2047,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!\reimp
*/
void QLineEdit::dragMoveEvent(QDragMoveEvent *e)
@@ -2110,7 +2112,7 @@ void QLineEdit::dropEvent(QDropEvent* e)
}
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
#ifndef QT_NO_CONTEXTMENU
/*!
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index b3be97e9b7..de82927f74 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -218,7 +218,7 @@ protected:
void focusInEvent(QFocusEvent *) override;
void focusOutEvent(QFocusEvent *) override;
void paintEvent(QPaintEvent *) override;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void dragEnterEvent(QDragEnterEvent *) override;
void dragMoveEvent(QDragMoveEvent *e) override;
void dragLeaveEvent(QDragLeaveEvent *e) override;
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index bfb92468be..17d7e298a1 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -44,7 +44,9 @@
#if QT_CONFIG(itemviews)
#include "qabstractitemview.h"
#endif
+#if QT_CONFIG(draganddrop)
#include "qdrag.h"
+#endif
#include "qwidgetaction.h"
#include "qclipboard.h"
#ifndef QT_NO_ACCESSIBILITY
@@ -311,7 +313,7 @@ bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
return false;
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
void QLineEditPrivate::drag()
{
Q_Q(QLineEdit);
@@ -324,8 +326,7 @@ void QLineEditPrivate::drag()
if (action == Qt::MoveAction && !control->isReadOnly() && drag->target() != q)
control->removeSelection();
}
-
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
#if QT_CONFIG(toolbutton)
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 39f670b0b0..71a67e3d10 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -211,7 +211,7 @@ public:
void _q_completionHighlighted(const QString &);
#endif
QPoint mousePressPos;
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
QBasicTimer dndTimer;
void drag();
#endif
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 8f295ce955..f15a846b5e 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -44,7 +44,9 @@
#include <qpainter.h>
#include <qevent.h>
#include <qdebug.h>
+#if QT_CONFIG(draganddrop)
#include <qdrag.h>
+#endif
#include <qclipboard.h>
#include <qmath.h>
#if QT_CONFIG(menu)
@@ -2141,7 +2143,7 @@ void QPlainTextEdit::contextMenuEvent(QContextMenuEvent *e)
}
#endif // QT_NO_CONTEXTMENU
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*! \reimp
*/
void QPlainTextEdit::dragEnterEvent(QDragEnterEvent *e)
@@ -2182,7 +2184,7 @@ void QPlainTextEdit::dropEvent(QDropEvent *e)
d->sendControlEvent(e);
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
/*! \reimp
*/
diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index 34ec96715e..e5ac4c82b8 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -247,7 +247,7 @@ protected:
#ifndef QT_NO_CONTEXTMENU
virtual void contextMenuEvent(QContextMenuEvent *e) override;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
virtual void dragEnterEvent(QDragEnterEvent *e) override;
virtual void dragLeaveEvent(QDragLeaveEvent *e) override;
virtual void dragMoveEvent(QDragMoveEvent *e) override;
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 3e26b04327..c92e38f74a 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -1668,7 +1668,7 @@ bool QTabBar::event(QEvent *event)
d->updateMacBorderMetrics();
return QWidget::event(event);
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
} else if (event->type() == QEvent::DragEnter) {
if (d->changeCurrentOnDrag)
event->accept();
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 6bc4c113ce..bbcd3ca386 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -49,7 +49,9 @@
#include <qpainter.h>
#include <qevent.h>
#include <qdebug.h>
+#if QT_CONFIG(draganddrop)
#include <qdrag.h>
+#endif
#include <qclipboard.h>
#if QT_CONFIG(menu)
#include <qmenu.h>
@@ -1647,7 +1649,7 @@ void QTextEdit::contextMenuEvent(QContextMenuEvent *e)
}
#endif // QT_NO_CONTEXTMENU
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*! \reimp
*/
void QTextEdit::dragEnterEvent(QDragEnterEvent *e)
@@ -1688,7 +1690,7 @@ void QTextEdit::dropEvent(QDropEvent *e)
d->sendControlEvent(e);
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
/*! \reimp
*/
diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h
index 9e0913160d..51d6c2ccba 100644
--- a/src/widgets/widgets/qtextedit.h
+++ b/src/widgets/widgets/qtextedit.h
@@ -284,7 +284,7 @@ protected:
#ifndef QT_NO_CONTEXTMENU
virtual void contextMenuEvent(QContextMenuEvent *e) override;
#endif
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
virtual void dragEnterEvent(QDragEnterEvent *e) override;
virtual void dragLeaveEvent(QDragLeaveEvent *e) override;
virtual void dragMoveEvent(QDragMoveEvent *e) override;
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 43c1c3e365..e179ea3b40 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -46,7 +46,9 @@
#include <qpainter.h>
#include <qevent.h>
#include <qdebug.h>
+#if QT_CONFIG(draganddrop)
#include <qdrag.h>
+#endif
#include <qclipboard.h>
#if QT_CONFIG(menu)
#include <qmenu.h>
@@ -129,7 +131,7 @@ QWidgetTextControlPrivate::QWidgetTextControlPrivate()
interactionFlags(Qt::TextEditable | Qt::TextSelectableByKeyboard),
#endif
dragEnabled(true),
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
mousePressed(false), mightStartDrag(false),
#endif
lastSelectionPosition(0), lastSelectionAnchor(0),
@@ -514,7 +516,7 @@ void QWidgetTextControlPrivate::setContent(Qt::TextFormat format, const QString
void QWidgetTextControlPrivate::startDrag()
{
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
Q_Q(QWidgetTextControl);
mousePressed = false;
if (!contextWidget)
@@ -1066,7 +1068,7 @@ void QWidgetTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget
}
#endif // QT_NO_TOOLTIP
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::DragEnter: {
QDragEnterEvent *ev = static_cast<QDragEnterEvent *>(e);
if (d->dragEnterEvent(e, ev->mimeData()))
@@ -1545,7 +1547,7 @@ void QWidgetTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton butto
mousePressPos = pos.toPoint();
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
mightStartDrag = false;
#endif
@@ -1615,7 +1617,7 @@ void QWidgetTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton butto
&& cursorPos >= cursor.selectionStart()
&& cursorPos <= cursor.selectionEnd()
&& q->hitTest(pos, Qt::ExactHit) != -1) {
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
mightStartDrag = true;
#endif
return;
@@ -1744,7 +1746,7 @@ void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton but
const int oldCursorPos = cursor.position();
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
if (mightStartDrag && (button & Qt::LeftButton)) {
mousePressed = false;
setCursorPosition(pos);
@@ -1807,7 +1809,7 @@ void QWidgetTextControlPrivate::mouseDoubleClickEvent(QEvent *e, Qt::MouseButton
if (button == Qt::LeftButton
&& (interactionFlags & Qt::TextSelectableByMouse)) {
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
mightStartDrag = false;
#endif
commitPreedit();