summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmainwindowlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/widgets/qmainwindowlayout.cpp')
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 9cf2e7de1f..d4ce0ffa4c 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -317,6 +317,9 @@ bool QDockWidgetGroupWindow::event(QEvent *e)
// We might need to show the widget again
destroyOrHideIfEmpty();
break;
+ case QEvent::Resize:
+ updateCurrentGapRect();
+ emit resized();
default:
break;
}
@@ -467,6 +470,8 @@ void QDockWidgetGroupWindow::adjustFlags()
}
if (oldFlags != flags) {
+ if (!windowHandle())
+ create(); // The desired geometry is forgotten if we call setWindowFlags before having a window
setWindowFlags(flags);
const bool gainedNativeDecos = (oldFlags & Qt::FramelessWindowHint) && !(flags & Qt::FramelessWindowHint);
const bool lostNativeDecos = !(oldFlags & Qt::FramelessWindowHint) && (flags & Qt::FramelessWindowHint);
@@ -546,12 +551,18 @@ bool QDockWidgetGroupWindow::hover(QLayoutItem *widgetItem, const QPoint &mouseP
currentGapPos = newGapPos;
newState.insertGap(currentGapPos, widgetItem);
newState.fitItems();
- currentGapRect = newState.info(currentGapPos)->itemRect(currentGapPos.last(), true);
*layoutInfo() = std::move(newState);
+ updateCurrentGapRect();
layoutInfo()->apply(opts & QMainWindow::AnimatedDocks);
return true;
}
+void QDockWidgetGroupWindow::updateCurrentGapRect()
+{
+ if (!currentGapPos.isEmpty())
+ currentGapRect = layoutInfo()->info(currentGapPos)->itemRect(currentGapPos.last(), true);
+}
+
/*
Remove the gap that was created by hover()
*/
@@ -1977,6 +1988,8 @@ void QMainWindowLayout::setCurrentHoveredFloat(QDockWidgetGroupWindow *w)
if (currentHoveredFloat) {
disconnect(currentHoveredFloat.data(), &QObject::destroyed,
this, &QMainWindowLayout::updateGapIndicator);
+ disconnect(currentHoveredFloat.data(), &QDockWidgetGroupWindow::resized,
+ this, &QMainWindowLayout::updateGapIndicator);
if (currentHoveredFloat)
currentHoveredFloat->restore();
} else if (w) {
@@ -1988,6 +2001,8 @@ void QMainWindowLayout::setCurrentHoveredFloat(QDockWidgetGroupWindow *w)
if (w) {
connect(w, &QObject::destroyed,
this, &QMainWindowLayout::updateGapIndicator, Qt::UniqueConnection);
+ connect(w, &QDockWidgetGroupWindow::resized,
+ this, &QMainWindowLayout::updateGapIndicator, Qt::UniqueConnection);
}
updateGapIndicator();
@@ -2559,6 +2574,7 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
dropTo->show();
dropTo->d_func()->plug(QRect());
w = floatingTabs;
+ widget->raise(); // raise, as our newly created drop target is now on top
}
Q_ASSERT(qobject_cast<QDockWidgetGroupWindow *>(w));
auto group = static_cast<QDockWidgetGroupWindow *>(w);