diff options
Diffstat (limited to 'src/widgets/widgets/qdockwidget_p.h')
-rw-r--r-- | src/widgets/widgets/qdockwidget_p.h | 69 |
1 files changed, 22 insertions, 47 deletions
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h index e663ec4c2d..6d3d307729 100644 --- a/src/widgets/widgets/qdockwidget_p.h +++ b/src/widgets/widgets/qdockwidget_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 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: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 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 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. -** -** 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$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QDYNAMICDOCKWIDGET_P_H #define QDYNAMICDOCKWIDGET_P_H @@ -77,6 +41,8 @@ class QDockWidgetPrivate : public QWidgetPrivate struct DragState { QPoint pressPos; + QPoint globalPressPos; + QPoint widgetInitialPos; bool dragging; QLayoutItem *widgetItem; bool ownWidgetItem; @@ -85,11 +51,22 @@ class QDockWidgetPrivate : public QWidgetPrivate }; public: + enum class DragScope { + Group, + Widget + }; + + enum class EndDragMode { + LocationChange, + Abort + }; + void init(); - void _q_toggleView(bool); // private slot - void _q_toggleTopLevel(); // private slot + void toggleView(bool); + void toggleTopLevel(); void updateButtons(); + static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos); #if QT_CONFIG(tabwidget) QTabWidget::TabPosition tabPosition = QTabWidget::North; @@ -119,16 +96,18 @@ public: void setWindowState(bool floating, bool unplug = false, const QRect &rect = QRect()); void nonClientAreaMouseEvent(QMouseEvent *event); void initDrag(const QPoint &pos, bool nca); - void startDrag(bool group = true); - void endDrag(bool abort = false); + void startDrag(DragScope scope); + void endDrag(EndDragMode mode); void moveEvent(QMoveEvent *event); void recalculatePressPos(QResizeEvent *event); void unplug(const QRect &rect); void plug(const QRect &rect); void setResizerActive(bool active); + void setFloating(bool floating); bool isAnimating() const; + bool isTabbed() const; private: QWidgetResizeHandler *resizer = nullptr; @@ -172,7 +151,7 @@ public: bool verticalTitleBar; private: - QVector<QLayoutItem*> item_list; + QList<QLayoutItem *> item_list; QRect _titleArea; }; @@ -201,11 +180,7 @@ inline QLayoutItem *QDockWidgetItem::dockWidgetChildItem() const inline QDockWidgetLayout *QDockWidgetItem::dockWidgetLayout() const { -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - QWidget *w = const_cast<QDockWidgetItem*>(this)->widget(); -#else QWidget *w = widget(); -#endif if (w != nullptr) return qobject_cast<QDockWidgetLayout*>(w->layout()); return nullptr; |