mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 07:31:33 +08:00
Fixed adding of dock widgets to floating widget
This commit is contained in:
parent
44dc76bd19
commit
0a096869fe
@ -58,6 +58,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@ -166,7 +167,8 @@ struct MainWindowPrivate
|
|||||||
QComboBox* PerspectiveComboBox = nullptr;
|
QComboBox* PerspectiveComboBox = nullptr;
|
||||||
ads::CDockManager* DockManager = nullptr;
|
ads::CDockManager* DockManager = nullptr;
|
||||||
ads::CDockWidget* WindowTitleTestDockWidget = nullptr;
|
ads::CDockWidget* WindowTitleTestDockWidget = nullptr;
|
||||||
ads::CDockWidget* LastDockedEditor = nullptr;
|
QPointer<ads::CDockWidget> LastDockedEditor;
|
||||||
|
QPointer<ads::CDockWidget> LastCreatedFloatingEditor;
|
||||||
|
|
||||||
MainWindowPrivate(CMainWindow* _public) : _this(_public) {}
|
MainWindowPrivate(CMainWindow* _public) : _this(_public) {}
|
||||||
|
|
||||||
@ -719,18 +721,30 @@ void CMainWindow::createEditor()
|
|||||||
{
|
{
|
||||||
auto FloatingWidget = d->DockManager->addDockWidgetFloating(DockWidget);
|
auto FloatingWidget = d->DockManager->addDockWidgetFloating(DockWidget);
|
||||||
FloatingWidget->move(QPoint(20, 20));
|
FloatingWidget->move(QPoint(20, 20));
|
||||||
|
d->LastCreatedFloatingEditor = DockWidget;
|
||||||
|
d->LastDockedEditor.clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ads::CDockAreaWidget* EditorArea = d->LastDockedEditor ? d->LastDockedEditor->dockAreaWidget() : nullptr;
|
ads::CDockAreaWidget* EditorArea = d->LastDockedEditor ? d->LastDockedEditor->dockAreaWidget() : nullptr;
|
||||||
if (EditorArea)
|
if (EditorArea)
|
||||||
{
|
{
|
||||||
|
std::cout << "DockAreaCount before: " << EditorArea->dockContainer()->dockAreaCount() << std::endl;
|
||||||
d->DockManager->setConfigFlag(ads::CDockManager::EqualSplitOnInsertion, true);
|
d->DockManager->setConfigFlag(ads::CDockManager::EqualSplitOnInsertion, true);
|
||||||
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, EditorArea);
|
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, EditorArea);
|
||||||
|
std::cout << "DockAreaCount after: " << DockWidget->dockContainer()->dockAreaCount() << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
d->DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
|
if (d->LastCreatedFloatingEditor)
|
||||||
|
{
|
||||||
|
std::cout << "LastCreated" << std::endl;
|
||||||
|
d->DockManager->addDockWidget(ads::RightDockWidgetArea, DockWidget, d->LastCreatedFloatingEditor->dockAreaWidget());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d->DockManager->addDockWidget(ads::TopDockWidgetArea, DockWidget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
d->LastDockedEditor = DockWidget;
|
d->LastDockedEditor = DockWidget;
|
||||||
}
|
}
|
||||||
|
@ -1253,7 +1253,6 @@ CDockAreaWidget* DockContainerWidgetPrivate::addDockWidgetToDockArea(DockWidgetA
|
|||||||
{
|
{
|
||||||
adjustSplitterSizesOnInsertion(TargetAreaSplitter);
|
adjustSplitterSizesOnInsertion(TargetAreaSplitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1273,8 +1272,7 @@ CDockAreaWidget* DockContainerWidgetPrivate::addDockWidgetToDockArea(DockWidgetA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appendDockAreas({NewDockArea});
|
addDockAreasToList({NewDockArea});
|
||||||
emitDockAreasAdded();
|
|
||||||
return NewDockArea;
|
return NewDockArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,7 +759,8 @@ CDockAreaWidget* CDockManager::addDockWidget(DockWidgetArea area,
|
|||||||
CDockWidget* Dockwidget, CDockAreaWidget* DockAreaWidget)
|
CDockWidget* Dockwidget, CDockAreaWidget* DockAreaWidget)
|
||||||
{
|
{
|
||||||
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
|
d->DockWidgetsMap.insert(Dockwidget->objectName(), Dockwidget);
|
||||||
auto AreaOfAddedDockWidget = CDockContainerWidget::addDockWidget(area, Dockwidget, DockAreaWidget);
|
auto Container = DockAreaWidget ? DockAreaWidget->dockContainer(): this;
|
||||||
|
auto AreaOfAddedDockWidget = Container->addDockWidget(area, Dockwidget, DockAreaWidget);
|
||||||
emit dockWidgetAdded(Dockwidget);
|
emit dockWidgetAdded(Dockwidget);
|
||||||
return AreaOfAddedDockWidget;
|
return AreaOfAddedDockWidget;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user