35 #include <QDomElement>
60 QDomElement elem = node.toElement();
72 QDomElement elem = node.toElement();
73 mGroup = elem.attribute(
"group").toInt();
74 mPlane = string2enum<PLANE_TYPE> (elem.attribute(
"type"));
85 return create(uid, name, 0, 0);
107 mName = mName +
" " + uid;
115 if (!this->
merge(region))
125 if (!this->
merge(region))
142 reportError(
"Attempted to merge a region outside allocated space in LayoutData.");
159 if (iter != this->
end())
165 mView.push_back(current);
190 if (iter == this->
end())
192 if (iter->mRegion.span.row == 1 && iter->mRegion.span.col == 1)
207 mView.push_back(newView);
219 if (mSize.
row == 0 || mSize.
col == 0)
229 if (iter->mRegion.pos.row >= rows || iter->mRegion.pos.col >= cols)
231 iter = mView.erase(iter);
240 for (
int r = 0; r < rows; ++r)
242 for (
int c = 0; c < cols; ++c)
259 return *(this->
find(pos));
266 if (iter->mRegion.contains(pos))
275 QDomDocument doc = node.ownerDocument();
276 QDomElement elem = node.toElement();
278 elem.setAttribute(
"uid", mUid);
279 elem.setAttribute(
"name", mName);
281 QDomElement
size = doc.createElement(
"size");
282 size.setAttribute(
"row", mSize.
row);
283 size.setAttribute(
"col", mSize.
col);
284 elem.appendChild(size);
288 QDomElement view = doc.createElement(
"view");
290 elem.appendChild(view);
299 QDomElement elem = node.toElement();
300 mUid = elem.attribute(
"uid");
301 mName = elem.attribute(
"name");
303 QDomElement
size = elem.namedItem(
"size").toElement();
304 mSize.
row = size.attribute(
"row").toInt();
305 mSize.
col = size.attribute(
"col").toInt();
309 QDomElement currentElem = elem.firstChildElement(
"view");
310 for (; !currentElem.isNull(); currentElem = currentElem.nextSiblingElement(
"view"))
314 mView.push_back(viewData);
QString qstring_cast(const T &val)
int mGroup
what group to connect to. -1 means not set.
void reportError(QString msg)
static LayoutData createHeader(QString uid, QString name)
ViewDataContainer::iterator iterator
LayoutPosition span
size of region
bool merge(LayoutRegion region)
void setName(const QString &name)
void parseXml(QDomNode node)
load state from xml
PLANE_TYPE mPlane
ptNOPLANE means 3D
LayoutViewData & get(LayoutPosition pos)
iterator find(LayoutPosition pos)
void split(iterator iter)
void resize(int rows, int cols)
void setView(int group, PLANE_TYPE type, LayoutRegion region)
void parseXml(QDomNode node)
load state from xml
LayoutPosition size() const
ptNOPLANE
a initial plane, if no yet set
LayoutPosition pos
start position of region
void resetUid(const QString &uid)
ViewDataContainer::const_iterator const_iterator
void addXml(QDomNode node) const
save state to xml
void addXml(QDomNode node) const
save state to xml
LayoutRegion merge(LayoutRegion a, LayoutRegion b)
static LayoutData create(QString uid, QString name, int rows, int cols)