Implements storeGeometry() and restoreGeometry() for ContainerWidget. It
correctly aligns all widgets... wohooo.
This commit is contained in:
@@ -50,6 +50,10 @@ public:
|
||||
|
||||
QMenu* createContextMenu() const;
|
||||
|
||||
private:
|
||||
void saveGeometryWalk(QDataStream& out, QWidget* widget) const;
|
||||
bool restoreGeometryWalk(QDataStream& in, QSplitter* currentSplitter = NULL);
|
||||
|
||||
signals:
|
||||
void orientationChanged();
|
||||
|
||||
@@ -63,8 +67,8 @@ public:
|
||||
|
||||
// Layout stuff
|
||||
QGridLayout* _mainLayout;
|
||||
Qt::Orientation _orientation; ///< Default orientation of new sections.
|
||||
QPointer<QSplitter> _splitter; ///< Default/main splitter.
|
||||
Qt::Orientation _orientation;
|
||||
QPointer<QSplitter> _splitter;
|
||||
};
|
||||
|
||||
ADS_NAMESPACE_END
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QWidget>
|
||||
#include <QHash>
|
||||
#include <QSharedPointer>
|
||||
#include <QWeakPointer>
|
||||
|
||||
#include "ads/API.h"
|
||||
|
||||
@@ -12,28 +13,32 @@ ADS_NAMESPACE_BEGIN
|
||||
|
||||
class SectionContent
|
||||
{
|
||||
friend class ContainerWidget;
|
||||
|
||||
private:
|
||||
SectionContent(QWidget* title, QWidget* content, const QString& uniqueName = QString()); ///< Do not use!
|
||||
|
||||
public:
|
||||
typedef QSharedPointer<SectionContent> RefPtr;
|
||||
typedef QWeakPointer<SectionContent> WeakPtr;
|
||||
|
||||
SectionContent(QWidget* title, QWidget* content, const QString& uniqueName = QString()); ///< Do not use!
|
||||
virtual ~SectionContent();
|
||||
|
||||
int uid() const;
|
||||
QString uniqueName() const;
|
||||
QWidget* titleWidget() const;
|
||||
QWidget* contentWidget() const;
|
||||
|
||||
static RefPtr newSectionContent(QWidget* title, QWidget* content);
|
||||
static RefPtr newSectionContent(const QString& title, QWidget* content);
|
||||
static RefPtr newSectionContent(QWidget* title, QWidget* content, const QString& uniqueName = QString());
|
||||
|
||||
public:
|
||||
private:
|
||||
const int _uid;
|
||||
const QString _uniqueName;
|
||||
QPointer<QWidget> _title;
|
||||
QPointer<QWidget> _content;
|
||||
|
||||
static int NextUid;
|
||||
static QHash<int, SectionContent*> LookupMap;
|
||||
static QHash<int, SectionContent::WeakPtr> LookupMap;
|
||||
static QHash<QString, SectionContent::WeakPtr> LookupMapByName;
|
||||
};
|
||||
|
||||
ADS_NAMESPACE_END
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
QRect titleAreaGeometry() const;
|
||||
QRect contentAreaGeometry() const;
|
||||
|
||||
QList<SectionContent::RefPtr> contents() const { return _contents; }
|
||||
const QList<SectionContent::RefPtr>& contents() const { return _contents; }
|
||||
void addContent(SectionContent::RefPtr c);
|
||||
void addContent(const InternalContentData& data, bool autoActivate);
|
||||
InternalContentData take(int uid, bool del = true);
|
||||
|
||||
Reference in New Issue
Block a user