本文整理汇总了C++中PropertyList::push_front方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyList::push_front方法的具体用法?C++ PropertyList::push_front怎么用?C++ PropertyList::push_front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyList
的用法示例。
在下文中一共展示了PropertyList::push_front方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scaleFormTemplate
// Set a fixed size on a XML template
QString WidgetDataBase::scaleFormTemplate(const QString &xml, const QSize &size, bool fixed)
{
typedef QList<DomProperty*> PropertyList;
DomUI *domUI = QDesignerWidgetBox::xmlToUi(QLatin1String("Form"), xml, false);
if (!domUI)
return QString();
DomWidget *domWidget = domUI->elementWidget();
if (!domWidget)
return QString();
// Properties: Find/Ensure the geometry, minimum and maximum sizes properties
const QString geometryPropertyName = QLatin1String("geometry");
const QString minimumSizePropertyName = QLatin1String("minimumSize");
const QString maximumSizePropertyName = QLatin1String("maximumSize");
DomProperty *geomProperty = 0;
DomProperty *minimumSizeProperty = 0;
DomProperty *maximumSizeProperty = 0;
PropertyList properties = domWidget->elementProperty();
const PropertyList::const_iterator cend = properties.constEnd();
for (PropertyList::const_iterator it = properties.constBegin(); it != cend; ++it) {
const QString name = (*it)->attributeName();
if (name == geometryPropertyName) {
geomProperty = *it;
} else {
if (name == minimumSizePropertyName) {
minimumSizeProperty = *it;
} else {
if (name == maximumSizePropertyName)
maximumSizeProperty = *it;
}
}
}
if (!geomProperty) {
geomProperty = new DomProperty;
geomProperty->setAttributeName(geometryPropertyName);
geomProperty->setElementRect(new DomRect);
properties.push_front(geomProperty);
}
if (fixed) {
if (!minimumSizeProperty) {
minimumSizeProperty = new DomProperty;
minimumSizeProperty->setAttributeName(minimumSizePropertyName);
minimumSizeProperty->setElementSize(new DomSize);
properties.push_back(minimumSizeProperty);
}
if (!maximumSizeProperty) {
maximumSizeProperty = new DomProperty;
maximumSizeProperty->setAttributeName(maximumSizePropertyName);
maximumSizeProperty->setElementSize(new DomSize);
properties.push_back(maximumSizeProperty);
}
}
// Set values of geometry, minimum and maximum sizes properties
const int width = size.width();
const int height = size.height();
if (DomRect *geom = geomProperty->elementRect()) {
geom->setElementWidth(width);
geom->setElementHeight(height);
}
if (fixed) {
if (DomSize *s = minimumSizeProperty->elementSize()) {
s->setElementWidth(width);
s->setElementHeight(height);
}
if (DomSize *s = maximumSizeProperty->elementSize()) {
s->setElementWidth(width);
s->setElementHeight(height);
}
}
// write back
domWidget->setElementProperty(properties);
QString rc;
{ // serialize domUI
QXmlStreamWriter writer(&rc);
writer.setAutoFormatting(true);
writer.setAutoFormattingIndent(1);
writer.writeStartDocument();
domUI->write(writer);
writer.writeEndDocument();
}
delete domUI;
return rc;
}