summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-02 09:04:38 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-02 09:04:38 +0100
commit71264bae08d81bdeceb96133fdb01c370504dfcc (patch)
treed5dadaac8209d5ef1857a4d65197b9ee12b39848 /src/widgets/widgets
parent5e785c0b83c9908c665f253c131629ac325a21f5 (diff)
parent6d10f739cd750968d0dd0e9d8fa4b64353a86c6c (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qbuttongroup_p.h34
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp2
-rw-r--r--src/widgets/widgets/qdockwidget.cpp13
-rw-r--r--src/widgets/widgets/qdockwidget_p.h1
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp9
5 files changed, 39 insertions, 20 deletions
diff --git a/src/widgets/widgets/qbuttongroup_p.h b/src/widgets/widgets/qbuttongroup_p.h
index b94dd170b4..93f3f4e0ec 100644
--- a/src/widgets/widgets/qbuttongroup_p.h
+++ b/src/widgets/widgets/qbuttongroup_p.h
@@ -1,31 +1,37 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index af3c2c29e2..e730eddd57 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -2065,7 +2065,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 28b97b2107..2928d51d20 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1021,6 +1021,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
*/
@@ -1537,6 +1543,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 4f94f6e654..63b6bcfaef 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -2100,10 +2100,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
@@ -2278,7 +2276,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);
}
}
}