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";
#if QT_CONFIG(draganddrop)
static bool hasSupportedFormat(const QMimeData *data)
{
return data->hasFormat(QLatin1StringView(uriListMimeType));
}
#endif // QT_CONFIG(draganddrop)
/*!
\reimp

View File

@ -429,13 +429,14 @@ Qt::DropActions QListModel::supportedDropActions() const
{
return view()->supportedDropActions();
}
#endif // QT_CONFIG(draganddrop)
Qt::DropActions QListModel::supportedDragActions() const
{
return view()->supportedDragActions();
}
#endif // QT_CONFIG(draganddrop)
/*!
\class QListWidgetItem
\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)
/*!
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
@ -1841,7 +1843,6 @@ Qt::DropActions QListWidget::supportedDropActions() const
Q_D(const QListWidget);
return d->listModel()->QAbstractListModel::supportedDropActions() | Qt::MoveAction;
}
#endif // QT_CONFIG(draganddrop)
/*!
Returns the drag actions supported by this view.
@ -1868,6 +1869,8 @@ void QListWidget::setSupportedDragActions(Qt::DropActions actions)
d->supportedDragActions = actions;
}
#endif // QT_CONFIG(draganddrop)
/*!
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

View File

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

View File

@ -97,9 +97,8 @@ public:
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
int row, int column, const QModelIndex &parent) override;
Qt::DropActions supportedDropActions() const override;
#endif
Qt::DropActions supportedDragActions() const override;
#endif
QMimeData *internalMimeData() const;
private:
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
if (unplug && !QMainWindowLayout::needsPlatformDrag())
flags |= Qt::X11BypassWindowManagerHint;
#else
Q_UNUSED(unplug);
#endif
q->setWindowFlags(flags);