Implemented XML serialization and loading of docking state

This commit is contained in:
Uwe Kindler
2017-12-29 18:18:16 +01:00
parent 8a014a6c2d
commit dae852d9f9
11 changed files with 245 additions and 159 deletions

View File

@@ -39,6 +39,7 @@
#include <QDebug>
#include <QMenu>
#include <QSplitter>
#include <QXmlStreamWriter>
#include "DockContainerWidget.h"
@@ -706,15 +707,18 @@ void CDockAreaWidget::updateDockArea()
//============================================================================
void CDockAreaWidget::saveState(QDataStream& stream) const
void CDockAreaWidget::saveState(QXmlStreamWriter& s) const
{
stream << d->ContentsLayout->count() << d->ContentsLayout->currentIndex();
s.writeStartElement("DockAreaWidget");
s.writeAttribute("Tabs", QString::number(d->ContentsLayout->count()));
s.writeAttribute("CurrentIndex", QString::number(d->ContentsLayout->currentIndex()));
qDebug() << "CDockAreaWidget::saveState TabCount: " << d->ContentsLayout->count()
<< " CurrentIndex: " << d->ContentsLayout->currentIndex();
for (int i = 0; i < d->ContentsLayout->count(); ++i)
{
dockWidget(i)->saveState(stream);
dockWidget(i)->saveState(s);
}
s.writeEndElement();
}
} // namespace ads