summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorSergio Martins <iamsergio@gmail.com>2018-04-11 14:20:34 +0100
committerSérgio Martins <sergio.martins@kdab.com>2018-04-12 13:55:12 +0000
commit144ee494b774fdc0fcdfdda53ebd8d4807a270dc (patch)
tree7caeaaaf756642965d14024c804d26302bc3c7b3 /src/widgets
parent2cc977665260c828b9652fdc49f145577bf39ebc (diff)
dockwidgets: Resize the rubber-band when our drop target is resized
Bug can be seen on the .gif attached to QTBUG-67611, the floating group window resizes, but the rubber band still has the old size. Change-Id: I7232a39574ea06fe036c75c21e7496c0f32f4632 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp15
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h4
2 files changed, 18 insertions, 1 deletions
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 34ad88913d..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;
}
@@ -548,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()
*/
@@ -1979,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) {
@@ -1990,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();
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 168d4444b9..53e045aaae 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -338,12 +338,16 @@ public:
bool hasNativeDecos() const;
bool hover(QLayoutItem *widgetItem, const QPoint &mousePos);
+ void updateCurrentGapRect();
void restore();
void apply();
QRect currentGapRect;
QList<int> currentGapPos;
+signals:
+ void resized();
+
protected:
bool event(QEvent *) override;
void paintEvent(QPaintEvent*) override;