Fix -no-feature-draganddrop builds

Building tests will still cause build issues, but at least this lets you
build without them.

Change-Id: Iea5c93bf31593a5ee0f66c877da4d5a7ba9b6dc3
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
This commit is contained in:
Oliver Eftevaag 2025-04-08 13:57:21 +02:00
parent 253f34082f
commit ef7e5ea616
5 changed files with 12 additions and 5 deletions

View File

@ -51,10 +51,12 @@ QUrlModel::~QUrlModel()
constexpr char uriListMimeType[] = "text/uri-list"; constexpr char uriListMimeType[] = "text/uri-list";
#if QT_CONFIG(draganddrop)
static bool hasSupportedFormat(const QMimeData *data) static bool hasSupportedFormat(const QMimeData *data)
{ {
return data->hasFormat(QLatin1StringView(uriListMimeType)); return data->hasFormat(QLatin1StringView(uriListMimeType));
} }
#endif // QT_CONFIG(draganddrop)
/*! /*!
\reimp \reimp

View File

@ -429,13 +429,14 @@ Qt::DropActions QListModel::supportedDropActions() const
{ {
return view()->supportedDropActions(); return view()->supportedDropActions();
} }
#endif // QT_CONFIG(draganddrop)
Qt::DropActions QListModel::supportedDragActions() const Qt::DropActions QListModel::supportedDragActions() const
{ {
return view()->supportedDragActions(); return view()->supportedDragActions();
} }
#endif // QT_CONFIG(draganddrop)
/*! /*!
\class QListWidgetItem \class QListWidgetItem
\brief The QListWidgetItem class provides an item for use with the \brief The QListWidgetItem class provides an item for use with the
@ -1804,6 +1805,7 @@ QMimeData *QListWidget::mimeData(const QList<QListWidgetItem *> &items) const
} }
#if QT_CONFIG(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
@ -1841,7 +1843,6 @@ 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_CONFIG(draganddrop)
/*! /*!
Returns the drag actions supported by this view. Returns the drag actions supported by this view.
@ -1868,6 +1869,8 @@ void QListWidget::setSupportedDragActions(Qt::DropActions actions)
d->supportedDragActions = actions; d->supportedDragActions = actions;
} }
#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
the object was not created by a QListWidget in the same process, the list the object was not created by a QListWidget in the same process, the list

View File

@ -221,9 +221,10 @@ public:
QModelIndex indexFromItem(const QListWidgetItem *item) const; QModelIndex indexFromItem(const QListWidgetItem *item) const;
QListWidgetItem *itemFromIndex(const QModelIndex &index) const; QListWidgetItem *itemFromIndex(const QModelIndex &index) const;
#if QT_CONFIG(draganddrop)
void setSupportedDragActions(Qt::DropActions actions); void setSupportedDragActions(Qt::DropActions actions);
Qt::DropActions supportedDragActions() const; Qt::DropActions supportedDragActions() const;
#endif
protected: protected:
#if QT_CONFIG(draganddrop) #if QT_CONFIG(draganddrop)
void dropEvent(QDropEvent *event) override; void dropEvent(QDropEvent *event) override;

View File

@ -97,9 +97,8 @@ public:
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;
#endif
Qt::DropActions supportedDragActions() const override; Qt::DropActions supportedDragActions() const override;
#endif
QMimeData *internalMimeData() const; QMimeData *internalMimeData() const;
private: private:
QList<QListWidgetItem*> items; QList<QListWidgetItem*> items;

View File

@ -115,6 +115,8 @@ void QToolBarPrivate::updateWindowFlags(bool floating, bool unplug)
// the platform window when it would be removed later // the platform window when it would be removed later
if (unplug && !QMainWindowLayout::needsPlatformDrag()) if (unplug && !QMainWindowLayout::needsPlatformDrag())
flags |= Qt::X11BypassWindowManagerHint; flags |= Qt::X11BypassWindowManagerHint;
#else
Q_UNUSED(unplug);
#endif #endif
q->setWindowFlags(flags); q->setWindowFlags(flags);