diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-10 21:10:21 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-10 22:35:04 +0100 |
commit | 364b161122b567e3a6f7343d438fb540b9fb7e5c (patch) | |
tree | 3d49953be9a58295a8c956cf5fdb00f581020605 /src/widgets/widgets/qmainwindowlayout.cpp | |
parent | e58401a75b29beb38d37a40072106d5ef7cb0336 (diff) | |
parent | 8a410f60ae39b06555d807581caf7cb8bfab4fac (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/widgets/widgets/qmainwindowlayout_p.h
Change-Id: Id406a67606b885052ed405b0fbc8eea7d9d03224
Diffstat (limited to 'src/widgets/widgets/qmainwindowlayout.cpp')
-rw-r--r-- | src/widgets/widgets/qmainwindowlayout.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 4ed4b8f767..4f94f6e654 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -1856,6 +1856,27 @@ void QMainWindowLayout::invalidate() minSize = szHint = QSize(); } +#ifndef QT_NO_DOCKWIDGET +void QMainWindowLayout::setCurrentHoveredFloat(QWidget *w) +{ + if (currentHoveredFloat != w) { + if (currentHoveredFloat) { + disconnect(currentHoveredFloat.data(), &QObject::destroyed, + this, &QMainWindowLayout::updateGapIndicator); + } + + currentHoveredFloat = w; + + if (w) { + connect(w, &QObject::destroyed, + this, &QMainWindowLayout::updateGapIndicator, Qt::UniqueConnection); + } + + updateGapIndicator(); + } +} +#endif //QT_NO_DOCKWIDGET + /****************************************************************************** ** QMainWindowLayout - remaining stuff */ @@ -1942,7 +1963,7 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem) dropTo->setParent(floatingTabs); dropTo->show(); dropTo->d_func()->plug(QRect()); - currentHoveredFloat = floatingTabs; + setCurrentHoveredFloat(floatingTabs); } #endif // QT_CONFIG(tabwidget) #if QT_CONFIG(tabbar) @@ -2095,7 +2116,7 @@ void QMainWindowLayout::animationFinished(QWidget *widget) currentGapPos.clear(); pluggingWidget = 0; #if QT_CONFIG(dockwidget) - currentHoveredFloat = nullptr; + setCurrentHoveredFloat(nullptr); #endif //applying the state will make sure that the currentGap is updated correctly //and all the geometries (especially the one from the central widget) is correct @@ -2395,12 +2416,12 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos) if (!w->geometry().contains(mousePos)) continue; - currentHoveredFloat = w; + setCurrentHoveredFloat(w); restore(true); return; } } - currentHoveredFloat = Q_NULLPTR; + setCurrentHoveredFloat(nullptr); #endif //QT_NO_DOCKWIDGET QPoint pos = parentWidget()->mapFromGlobal(mousePos); |