diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-02-24 22:15:56 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2017-02-24 23:32:33 +0000 |
commit | 63856135dacba615ebfabdf03be2926dc763358f (patch) | |
tree | a0a29ebb0572b190f837c96c5eb8f4e310601b0d /src/widgets | |
parent | 14db1d5560254766746446069b6f2456e4444602 (diff) | |
parent | de49839df8abfba1f3ed3c36ef3177e4a9d6ef00 (diff) |
Merge "Merge remote-tracking branch 'origin/5.8' into 5.9" into refs/staging/5.9
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 7 | ||||
-rw-r--r-- | src/widgets/widgets/qdockarealayout.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qdockwidget.cpp | 13 | ||||
-rw-r--r-- | src/widgets/widgets/qdockwidget_p.h | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qmainwindowlayout.cpp | 9 |
5 files changed, 20 insertions, 12 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index cc895e2c33..f884a1c279 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -6669,12 +6669,7 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; } case CT_Menu: { - QStyleHintReturnMask menuMask; - QStyleOption myOption = *opt; - myOption.rect.setSize(sz); - if (proxy()->styleHint(SH_Menu_Mask, &myOption, widget, &menuMask)) { - sz = menuMask.region.boundingRect().size(); - } + sz = csz; break; } case CT_HeaderSection:{ const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt); diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index b33f2dc798..8d9280ebb5 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2092,7 +2092,7 @@ void QDockAreaLayoutInfo::reparentWidgets(QWidget *parent) const QDockAreaLayoutItem &item = item_list.at(i); if (item.flags & QDockAreaLayoutItem::GapItem) continue; - if (!item.widgetItem && item.skip()) + if (item.skip()) continue; if (item.subinfo) item.subinfo->reparentWidgets(parent); diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index aa5d809431..307a261a43 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -1026,6 +1026,12 @@ void QDockWidgetPrivate::nonClientAreaMouseEvent(QMouseEvent *event) } } +void QDockWidgetPrivate::recalculatePressPos(QResizeEvent *event) +{ + qreal ratio = event->oldSize().width() / (1.0 * event->size().width()); + state->pressPos.setX(state->pressPos.x() / ratio); +} + /*! \internal Called when the QDockWidget or the QDockWidgetGroupWindow is moved */ @@ -1542,6 +1548,13 @@ bool QDockWidget::event(QEvent *event) // if the mainwindow is plugging us, we don't want to update undocked geometry if (isFloating() && layout != 0 && layout->pluggingWidget != this) d->undockedGeometry = geometry(); + + // Usually the window won't get resized while it's being moved, but it can happen, + // for example on Windows when moving to a screen with bigger scale factor + // (and Qt::AA_EnableHighDpiScaling is enabled). If that happens we should + // update state->pressPos, otherwise it will be outside the window when the window shrinks. + if (d->state && d->state->dragging) + d->recalculatePressPos(static_cast<QResizeEvent*>(event)); break; default: break; diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h index 94a3ad3b34..84bf8efacf 100644 --- a/src/widgets/widgets/qdockwidget_p.h +++ b/src/widgets/widgets/qdockwidget_p.h @@ -118,6 +118,7 @@ public: void startDrag(bool group = true); void endDrag(bool abort = false); void moveEvent(QMoveEvent *event); + void recalculatePressPos(QResizeEvent *event); void unplug(const QRect &rect); void plug(const QRect &rect); diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp index 68ca571acf..640154063e 100644 --- a/src/widgets/widgets/qmainwindowlayout.cpp +++ b/src/widgets/widgets/qmainwindowlayout.cpp @@ -2195,10 +2195,8 @@ void QMainWindowLayout::animationFinished(QWidget *widget) } if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) { - if (currentHoveredFloat) { - dw->setParent(currentHoveredFloat); - dw->show(); - } + dw->setParent(currentHoveredFloat ? currentHoveredFloat.data() : parentWidget()); + dw->show(); dw->d_func()->plug(currentGapRect); } #endif @@ -2380,7 +2378,8 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget, bool group) // We are unplugging a dock widget from a floating window. if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget)) { dw->d_func()->unplug(widget->geometry()); - return 0; + int index = widget->parentWidget()->layout()->indexOf(widget); + return widget->parentWidget()->layout()->itemAt(index); } } } |