diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-02-22 12:21:46 +0100 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2017-04-13 17:44:58 +0000 |
commit | 4b0d6704d9e44b19c14958c031186ea17370755d (patch) | |
tree | 9df10bac437b243980d1a5361d48849a625924ad /src/widgets/widgets/qdockarealayout.cpp | |
parent | 60be2fb6a13315f074c3c0b7793c38632f291e8b (diff) | |
download | qtbase-4b0d6704d9e44b19c14958c031186ea17370755d.tar.gz |
DockWidgets: Allow to have floating dockwidgets side by side
Based on what MS VisualStudio can do, allow to have. We can now
drop the QDockWidgets on floating ones so that they are next to eachother
This is activated when QMainWindow::GroupedDragging and
QMainWindow::AllowNestedDocks are both set.
[ChangeLog][QtWidgets][QDockWidget] When QMainWindow::GrouppedDragging
and QMainWindow::AllowNestedDocks are both enabled, floating dock widgets
acquired the ability to be dropped together side by side.
Change-Id: I48765c72ef80ef15aa31b91ae582cbb01dea41d6
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
Diffstat (limited to 'src/widgets/widgets/qdockarealayout.cpp')
-rw-r--r-- | src/widgets/widgets/qdockarealayout.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index 27ecc33dba..60f6f6d26d 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -2418,20 +2418,21 @@ QList<int> QDockAreaLayout::indexOf(QWidget *dockWidget) const return QList<int>(); } -QList<int> QDockAreaLayout::gapIndex(const QPoint &pos) const +QList<int> QDockAreaLayout::gapIndex(const QPoint &pos, bool disallowTabs) const { QMainWindow::DockOptions opts = mainWindow->dockOptions(); bool nestingEnabled = opts & QMainWindow::AllowNestedDocks; QDockAreaLayoutInfo::TabMode tabMode = QDockAreaLayoutInfo::NoTabs; #ifndef QT_NO_TABBAR - if (opts & QMainWindow::AllowTabbedDocks - || opts & QMainWindow::VerticalTabs) - tabMode = QDockAreaLayoutInfo::AllowTabs; - if (opts & QMainWindow::ForceTabbedDocks) - tabMode = QDockAreaLayoutInfo::ForceTabs; + if (!disallowTabs) { + if (opts & QMainWindow::AllowTabbedDocks || opts & QMainWindow::VerticalTabs) + tabMode = QDockAreaLayoutInfo::AllowTabs; + if (opts & QMainWindow::ForceTabbedDocks) + tabMode = QDockAreaLayoutInfo::ForceTabs; - if (tabMode == QDockAreaLayoutInfo::ForceTabs) - nestingEnabled = false; + if (tabMode == QDockAreaLayoutInfo::ForceTabs) + nestingEnabled = false; + } #endif @@ -3303,6 +3304,19 @@ int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &or return delta; } +int QDockAreaLayoutInfo::separatorMove(const QList<int> &separator, const QPoint &origin, + const QPoint &dest) +{ + int delta = 0; + int index = separator.last(); + QDockAreaLayoutInfo *info = this->info(separator); + delta = pick(info->o, dest - origin); + if (delta != 0) + delta = info->separatorMove(index, delta); + info->apply(false); + return delta; +} + #ifndef QT_NO_TABBAR // Sets the correct positions for the separator widgets // Allocates new sepearator widgets with getSeparatorWidget |