Implements storeGeometry() and restoreGeometry() for ContainerWidget. It

correctly aligns all widgets... wohooo.
This commit is contained in:
mfreiholz
2016-02-11 14:33:02 +01:00
parent 7123410bb1
commit 9050d1910c
7 changed files with 181 additions and 29 deletions

View File

@@ -5,20 +5,21 @@
ADS_NAMESPACE_BEGIN
int SectionContent::NextUid = 1;
QHash<int, SectionContent*> SectionContent::LookupMap;
QHash<int, SectionContent::WeakPtr> SectionContent::LookupMap;
QHash<QString, SectionContent::WeakPtr> SectionContent::LookupMapByName;
SectionContent::SectionContent(QWidget* title, QWidget* content, const QString& uniqueName) :
_uid(NextUid++),
_uniqueName(uniqueName)
_uniqueName(uniqueName),
_title(title),
_content(content)
{
_title = title;
_content = content;
LookupMap.insert(_uid, this);
}
SectionContent::~SectionContent()
{
LookupMap.remove(_uid);
LookupMapByName.remove(_uniqueName);
delete _title;
delete _content;
}
@@ -43,14 +44,13 @@ QWidget* SectionContent::contentWidget() const
return _content;
}
SectionContent::RefPtr SectionContent::newSectionContent(QWidget* title, QWidget* content)
SectionContent::RefPtr SectionContent::newSectionContent(QWidget* title, QWidget* content, const QString& uniqueName)
{
return QSharedPointer<SectionContent>(new SectionContent(title, content));
}
SectionContent::RefPtr SectionContent::newSectionContent(const QString& title, QWidget* content)
{
return QSharedPointer<SectionContent>(new SectionContent(new QLabel(title), content));
QSharedPointer<SectionContent> sc(new SectionContent(title, content, uniqueName));
LookupMap.insert(sc->uid(), sc);
if (!sc->uniqueName().isEmpty())
LookupMapByName.insert(sc->uniqueName(), sc);
return sc;
}
ADS_NAMESPACE_END