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