mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Started inserting RootSplitter
This commit is contained in:
parent
1cd1e7d6ec
commit
a652deba71
@ -5,7 +5,7 @@
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(g?cc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW" console="false" env-hash="-797032510223863550" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings MinGW" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.internal.language.settings.providers.GCCBuiltinSpecsDetectorMinGW" console="false" env-hash="1111767096691303650" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetectorMinGW" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings MinGW" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -711,6 +711,8 @@ void CDockAreaWidget::onDockWidgetViewToggled(bool Open)
|
||||
void CDockAreaWidget::saveState(QDataStream& stream) const
|
||||
{
|
||||
stream << d->ContentsLayout->count() << d->ContentsLayout->currentIndex();
|
||||
std::cout << "CDockAreaWidget::saveState TabCount: " << d->ContentsLayout->count()
|
||||
<< " CurrentIndex: " << d->ContentsLayout->currentIndex() << std::endl;
|
||||
for (int i = 0; i < d->ContentsLayout->count(); ++i)
|
||||
{
|
||||
dockWidget(i)->saveState(stream);
|
||||
|
@ -39,6 +39,7 @@ class CDockManager;
|
||||
class CDockContainerWidget;
|
||||
class CDockWidget;
|
||||
|
||||
|
||||
/**
|
||||
* DockAreaWidget manages multiple instances of DckWidgets.
|
||||
* It displays a title tab, which is clickable and will switch to
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <QEvent>
|
||||
#include <QList>
|
||||
#include <QGridLayout>
|
||||
#include <QSplitter>
|
||||
#include <QPointer>
|
||||
|
||||
#include "DockManager.h"
|
||||
@ -43,6 +42,7 @@
|
||||
#include "DockOverlay.h"
|
||||
#include "DockStateSerialization.h"
|
||||
#include "ads_globals.h"
|
||||
#include "DockSplitter.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -75,6 +75,7 @@ struct DockContainerWidgetPrivate
|
||||
unsigned int zOrderIndex = 0;
|
||||
QList<CDockAreaWidget*> DockAreas;
|
||||
QGridLayout* Layout = nullptr;
|
||||
CDockSplitter* RootSplitter;
|
||||
bool isFloating = false;
|
||||
|
||||
/**
|
||||
@ -123,7 +124,7 @@ struct DockContainerWidgetPrivate
|
||||
/**
|
||||
* Restore state of child nodes
|
||||
*/
|
||||
void restoreChildNodes(QDataStream& Stream, QWidget* Parent);
|
||||
void restoreChildNodes(QDataStream& Stream, QWidget*& CreatedWidget);
|
||||
}; // struct DockContainerWidgetPrivate
|
||||
|
||||
|
||||
@ -310,10 +311,10 @@ void DockContainerWidgetPrivate::saveChildNodesState(QDataStream& stream, QWidge
|
||||
}
|
||||
else
|
||||
{
|
||||
stream << NodeDockArea;
|
||||
CDockAreaWidget* DockArea = dynamic_cast<CDockAreaWidget*>(Widget);
|
||||
if (DockArea)
|
||||
{
|
||||
std::cout << "NodeDockArea " << std::endl;
|
||||
DockArea->saveState(stream);
|
||||
}
|
||||
}
|
||||
@ -321,17 +322,27 @@ void DockContainerWidgetPrivate::saveChildNodesState(QDataStream& stream, QWidge
|
||||
|
||||
|
||||
//============================================================================
|
||||
void DockContainerWidgetPrivate::restoreChildNodes(QDataStream& stream, QWidget* Parent)
|
||||
void DockContainerWidgetPrivate::restoreChildNodes(QDataStream& stream,
|
||||
QWidget*& CreatedWidget)
|
||||
{
|
||||
int NodeType;
|
||||
stream >> NodeType;
|
||||
QSplitter* ParentSplitter = dynamic_cast<QSplitter*>(Parent);
|
||||
if (NodeSplitter == NodeType)
|
||||
{
|
||||
int Orientation;
|
||||
int Count;
|
||||
stream >> Orientation >> Count;
|
||||
std::cout << "Restore NodeSplitter " << Orientation << std::endl;
|
||||
int WidgetCount;
|
||||
stream >> Orientation >> WidgetCount;
|
||||
std::cout << "Restore NodeSplitter Orientation: " << Orientation <<
|
||||
" WidgetCount: " << WidgetCount << std::endl;
|
||||
for (int i = 0; i < WidgetCount; ++i)
|
||||
{
|
||||
QWidget* Widget;
|
||||
restoreChildNodes(stream, CreatedWidget);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*std::cout << "Restore NodeSplitter " << Orientation << std::endl;
|
||||
QSplitter* Splitter = internal::newSplitter((Qt::Orientation)Orientation);
|
||||
if (ParentSplitter)
|
||||
{
|
||||
@ -344,21 +355,37 @@ void DockContainerWidgetPrivate::restoreChildNodes(QDataStream& stream, QWidget*
|
||||
for (int i = 0; i < Count; ++i)
|
||||
{
|
||||
restoreChildNodes(stream, Splitter);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Restore NodeDockArea " << std::endl;
|
||||
CDockAreaWidget* DockArea = new CDockAreaWidget(DockManager, _this);
|
||||
if (ParentSplitter)
|
||||
int Tabs;
|
||||
int CurrentIndex;
|
||||
stream >> Tabs >> CurrentIndex;
|
||||
std::cout << "Restore NodeDockArea Tabs: " << Tabs << " CurrentIndex: "
|
||||
<< CurrentIndex << std::endl;
|
||||
for (int i = 0; i < Tabs; ++i)
|
||||
{
|
||||
ParentSplitter->addWidget(DockArea);
|
||||
QString ObjectName;
|
||||
bool Closed;
|
||||
stream >> ObjectName >> Closed;
|
||||
std::cout << "Restore DockWidget " << ObjectName.toStdString() << " Closed: "
|
||||
<< Closed << std::endl;
|
||||
|
||||
CDockWidget* DockWidget = DockManager->findChild<CDockWidget*>(ObjectName);
|
||||
if (!DockWidget)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Dock Widget found - parent " << DockWidget->parent()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
CDockAreaWidget* DockArea = new CDockAreaWidget(DockManager, _this);
|
||||
DockArea->addDockWidget(DockWidget);
|
||||
}
|
||||
else
|
||||
{
|
||||
Parent->layout()->addWidget(DockArea);
|
||||
}
|
||||
DockAreas.append(DockArea);
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,7 +407,10 @@ void DockContainerWidgetPrivate::addDockArea(CDockAreaWidget* NewDockArea, DockW
|
||||
auto InsertParam = internal::dockAreaInsertParameters(area);
|
||||
if (DockAreas.isEmpty())
|
||||
{
|
||||
_this->layout()->addWidget(NewDockArea);
|
||||
QSplitter* Splitter = internal::newSplitter(Qt::Horizontal);
|
||||
Splitter->addWidget(NewDockArea);
|
||||
insertWidgetIntoSplitter(Splitter, NewDockArea, InsertParam.append());
|
||||
_this->layout()->addWidget(Splitter);
|
||||
}
|
||||
else if (DockAreas.count() == 1)
|
||||
{
|
||||
@ -707,7 +737,17 @@ bool CDockContainerWidget::restoreState(QDataStream& stream)
|
||||
{
|
||||
bool IsFloating;
|
||||
stream >> IsFloating;
|
||||
if (isFloating())
|
||||
std::cout << "Restore CDockContainerWidget Floating" << IsFloating << std::endl;
|
||||
QWidget* RootChild = d->Layout->itemAt(0)->widget();
|
||||
if (RootChild)
|
||||
{
|
||||
d->DockAreas.clear();
|
||||
delete RootChild;
|
||||
}
|
||||
QWidget* Widget;
|
||||
d->restoreChildNodes(stream, Widget);
|
||||
|
||||
/*if (isFloating())
|
||||
{
|
||||
std::cout << "Restore floating widget" << std::endl;
|
||||
CFloatingDockContainer* FloatingWidget = internal::findParent<CFloatingDockContainer*>(this);
|
||||
@ -715,15 +755,8 @@ bool CDockContainerWidget::restoreState(QDataStream& stream)
|
||||
stream >> Geometry;
|
||||
FloatingWidget->restoreGeometry(Geometry);
|
||||
FloatingWidget->show();
|
||||
}
|
||||
}*/
|
||||
|
||||
QWidget* RootChild = d->Layout->itemAt(0)->widget();
|
||||
if (RootChild)
|
||||
{
|
||||
d->DockAreas.clear();
|
||||
delete RootChild;
|
||||
}
|
||||
d->restoreChildNodes(stream, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
27
src/DockSplitter.cpp
Normal file
27
src/DockSplitter.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
//============================================================================
|
||||
/// \file DockSplitter.cpp
|
||||
/// \author Uwe Kindler
|
||||
/// \date 24.03.2017
|
||||
/// \brief Implementation of CDockSplitter
|
||||
//============================================================================
|
||||
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <DockSplitter.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace ads
|
||||
{
|
||||
|
||||
//============================================================================
|
||||
CDockSplitter::~CDockSplitter()
|
||||
{
|
||||
std::cout << "~CDockSplitter" << std::endl;
|
||||
}
|
||||
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// EOF DockSplitter.cpp
|
36
src/DockSplitter.h
Normal file
36
src/DockSplitter.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef DockSplitterH
|
||||
#define DockSplitterH
|
||||
//============================================================================
|
||||
/// \file DockSplitter.h
|
||||
/// \author Uwe Kindler
|
||||
/// \date 24.03.2017
|
||||
/// \brief Declaration of CDockSplitter
|
||||
//============================================================================
|
||||
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <QSplitter>
|
||||
|
||||
namespace ads
|
||||
{
|
||||
|
||||
/**
|
||||
* Splitter used internally instead of QSplitter
|
||||
*/
|
||||
class CDockSplitter : public QSplitter
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QSplitter::QSplitter;
|
||||
|
||||
/**
|
||||
* Prints debug info
|
||||
*/
|
||||
virtual ~CDockSplitter();
|
||||
}; // class CDockSplitter
|
||||
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
#endif // DockSplitterH
|
@ -28,11 +28,12 @@
|
||||
//============================================================================
|
||||
// INCLUDES
|
||||
//============================================================================
|
||||
#include <QSplitter>
|
||||
#include <QVariant>
|
||||
|
||||
#include "DockSplitter.h"
|
||||
#include "ads_globals.h"
|
||||
|
||||
|
||||
namespace ads
|
||||
{
|
||||
|
||||
@ -41,7 +42,7 @@ namespace internal
|
||||
//============================================================================
|
||||
QSplitter* newSplitter(Qt::Orientation orientation, QWidget* parent)
|
||||
{
|
||||
QSplitter* s = new QSplitter(orientation, parent);
|
||||
QSplitter* s = new CDockSplitter(orientation, parent);
|
||||
s->setProperty("ads-splitter", QVariant(true));
|
||||
s->setChildrenCollapsible(false);
|
||||
s->setOpaqueResize(false);
|
||||
|
@ -39,7 +39,8 @@ HEADERS += \
|
||||
DockWidget.h \
|
||||
DockWidgetTitleBar.h \
|
||||
FloatingDockContainer.h \
|
||||
DockOverlay.h
|
||||
DockOverlay.h \
|
||||
DockSplitter.h
|
||||
|
||||
|
||||
|
||||
@ -51,4 +52,5 @@ SOURCES += \
|
||||
DockWidget.cpp \
|
||||
DockWidgetTitleBar.cpp \
|
||||
FloatingDockContainer.cpp \
|
||||
DockOverlay.cpp
|
||||
DockOverlay.cpp \
|
||||
DockSplitter.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user