mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Serialize current index of SectionWidget
This commit is contained in:
parent
cb3324284a
commit
861d5187e3
@ -42,6 +42,7 @@ public:
|
||||
int indexOfContent(SectionContent::RefPtr c) const;
|
||||
int indexOfContentByTitlePos(const QPoint& pos, QWidget* exclude = NULL) const;
|
||||
|
||||
int currentIndex() const;
|
||||
void moveContent(int from, int to);
|
||||
|
||||
public slots:
|
||||
|
@ -379,7 +379,7 @@ void ContainerWidget::saveGeometryWalk(QDataStream& out, QWidget* widget) const
|
||||
else if ((sw = dynamic_cast<SectionWidget*>(widget)) != NULL)
|
||||
{
|
||||
out << 2; // Type = SectionWidget
|
||||
out << sw->geometry();
|
||||
out << sw->currentIndex();
|
||||
out << sw->contents().count();
|
||||
const QList<SectionContent::RefPtr>& contents = sw->contents();
|
||||
for (int i = 0; i < contents.count(); ++i)
|
||||
@ -422,9 +422,9 @@ bool ContainerWidget::restoreGeometryWalk(QDataStream& in, QSplitter* currentSpl
|
||||
qWarning() << "Missing splitter object for section";
|
||||
return false;
|
||||
}
|
||||
QRect geom;
|
||||
int count;
|
||||
in >> geom >> count;
|
||||
|
||||
int currentIndex, count;
|
||||
in >> currentIndex >> count;
|
||||
|
||||
SectionWidget* sw = new SectionWidget(this);
|
||||
// sw->setGeometry(geom);
|
||||
@ -436,6 +436,7 @@ bool ContainerWidget::restoreGeometryWalk(QDataStream& in, QSplitter* currentSpl
|
||||
if (sc)
|
||||
sw->addContent(sc);
|
||||
}
|
||||
sw->setCurrentIndex(currentIndex);
|
||||
currentSplitter->addWidget(sw);
|
||||
}
|
||||
// Unknown
|
||||
|
@ -206,6 +206,11 @@ int SectionWidget::indexOfContentByTitlePos(const QPoint& p, QWidget* exclude) c
|
||||
return index;
|
||||
}
|
||||
|
||||
int SectionWidget::currentIndex() const
|
||||
{
|
||||
return _contentsLayout->currentIndex();
|
||||
}
|
||||
|
||||
void SectionWidget::moveContent(int from, int to)
|
||||
{
|
||||
if (from >= _contents.size() || from < 0 || to >= _contents.size() || to < 0 || from == to)
|
||||
|
Loading…
Reference in New Issue
Block a user