Fix bug after saving-restoring a empty container with no SectionWidget.

SectionTitleWidget::mousePressEvent call 'grabMouse' to ensure the floaing widget can always follow the mouse after floated.
SectionTitleWidget::mouseMoveEvent check Qt::LeftButton.
This commit is contained in:
tanaxiusi
2016-03-16 20:12:39 +08:00
parent d2d2467101
commit f2f5de707c
2 changed files with 22 additions and 16 deletions

View File

@@ -489,25 +489,28 @@ bool ContainerWidget::restoreState(const QByteArray& data)
int cnt = 0;
in >> cnt;
// Create dummy section, required to call hideSectionContent() later.
SectionWidget* sw = new SectionWidget(this);
sections.append(sw);
for (int i = 0; i < cnt; ++i)
if(cnt > 0)
{
QString uname;
in >> uname;
// Create dummy section, required to call hideSectionContent() later.
SectionWidget* sw = new SectionWidget(this);
sections.append(sw);
const SectionContent::RefPtr sc = SCLookupMapByName(this).value(uname);
if (!sc)
continue;
for (int i = 0; i < cnt; ++i)
{
QString uname;
in >> uname;
InternalContentData data;
if (!takeContent(sc, data))
qFatal("This should never happen!!!");
const SectionContent::RefPtr sc = SCLookupMapByName(this).value(uname);
if (!sc)
continue;
sw->addContent(data, false);
contentsToHide.append(sc);
InternalContentData data;
if (!takeContent(sc, data))
qFatal("This should never happen!!!");
sw->addContent(data, false);
contentsToHide.append(sc);
}
}
}
else if (mode == 1)