Fix build with -no-feature-dragandrop

Change-Id: I9ac2a9edb747608ef93008ac865886b1ee0ea82a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: David Redondo <qt@david-redondo.de>
This commit is contained in:
Tasuku Suzuki 2023-08-17 10:22:02 +09:00
parent 3965d52ad5
commit 7301cd5cfa
2 changed files with 12 additions and 0 deletions

View File

@ -780,7 +780,9 @@ void QDockWidgetPrivate::startDrag(bool group)
QMainWindowLayout *layout = qt_mainwindow_layout_from_dock(q);
Q_ASSERT(layout != nullptr);
#if QT_CONFIG(draganddrop)
bool wasFloating = q->isFloating();
#endif
state->widgetItem = layout->unplug(q, group);
if (state->widgetItem == nullptr) {
@ -1056,10 +1058,12 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event)
bool QDockWidgetPrivate::mouseReleaseEvent(QMouseEvent *event)
{
#if QT_CONFIG(mainwindow)
#if QT_CONFIG(draganddrop)
// if we are peforming a platform drag ignore the release here and end the drag when the actual
// drag ends.
if (QMainWindowLayout::needsPlatformDrag())
return false;
#endif
if (event->button() == Qt::LeftButton && state && !state->nca) {
endDrag();
@ -1207,10 +1211,12 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect
flags |= Qt::FramelessWindowHint;
}
#if QT_CONFIG(draganddrop)
// If we are performing a platform drag the flag is not needed and we want to avoid recreating
// the platform window when it would be removed later
if (unplug && !QMainWindowLayout::needsPlatformDrag())
flags |= Qt::X11BypassWindowManagerHint;
#endif
q->setWindowFlags(flags);

View File

@ -111,10 +111,12 @@ void QToolBarPrivate::updateWindowFlags(bool floating, bool unplug)
flags |= Qt::FramelessWindowHint;
#if QT_CONFIG(draganddrop)
// If we are performing a platform drag the flag is not needed and we want to avoid recreating
// the platform window when it would be removed later
if (unplug && !QMainWindowLayout::needsPlatformDrag())
flags |= Qt::X11BypassWindowManagerHint;
#endif
q->setWindowFlags(flags);
}
@ -178,7 +180,9 @@ void QToolBarPrivate::startDrag(bool moving)
QMainWindowLayout *layout = qt_mainwindow_layout(win);
Q_ASSERT(layout != nullptr);
#if QT_CONFIG(draganddrop)
const bool wasFloating = q->isFloating();
#endif
if (!moving) {
state->widgetItem = layout->unplug(q);
@ -264,10 +268,12 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
bool QToolBarPrivate::mouseReleaseEvent(QMouseEvent*)
{
#if QT_CONFIG(draganddrop)
// if we are peforming a platform drag ignore the release here and end the drag when the actual
// drag ends.
if (QMainWindowLayout::needsPlatformDrag())
return false;
#endif
if (state != nullptr) {
endDrag();