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>
This commit is contained in:
parent
2cc9776652
commit
144ee494b7
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user