本文整理汇总了C++中QXmlStreamWriter::writeAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlStreamWriter::writeAttribute方法的具体用法?C++ QXmlStreamWriter::writeAttribute怎么用?C++ QXmlStreamWriter::writeAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlStreamWriter
的用法示例。
在下文中一共展示了QXmlStreamWriter::writeAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void Properties::serializeTimeValuesOut( QString propertyName, QXmlStreamWriter& stream )
{
QMap< QDateTime, QVariant >* timeValueMap;
timeValueMap = _propertiesTimeValueMap.value( propertyName, nullptr );
if ( timeValueMap != nullptr )
{
stream.writeStartElement( "values" ); // <values>
QList< QDateTime > dateKeys = timeValueMap->keys( );
QList< QVariant > dateValues = timeValueMap->values( );
for ( int i = 0; i < dateKeys.size( ); i++ )
{
stream.writeStartElement( "dtv" ); // <dtv> DTV = Date Time Value
stream.writeAttribute( "d", dateKeys.at( i ).toString( ) );
stream.writeAttribute( "t", QString::number( dateValues.at( i ).type( ) ) );
stream.writeAttribute( "v", dateValues.at( i ).toString( ) );
stream.writeEndElement( ); // </dtv>
}
stream.writeEndElement( ); // </values>
}
}
示例2: saveXml
void CurveStyle::saveXml(QXmlStreamWriter &writer,
const QString &curveName) const
{
LOG4CPP_INFO_S ((*mainCat)) << "CurveStyle::saveXml";
writer.writeStartElement(DOCUMENT_SERIALIZE_CURVE_STYLE);
writer.writeAttribute (DOCUMENT_SERIALIZE_CURVE_NAME, curveName);
m_lineStyle.saveXml (writer);
m_pointStyle.saveXml (writer);
writer.writeEndElement();
}
示例3: save
void EditableMatrix::save(QXmlStreamWriter &xml) {
QByteArray qba(_zSize*sizeof(double), '\0');
QDataStream qds(&qba, QIODevice::WriteOnly);
for (int i = 0; i < _zSize; i++) {
qds << _z[i];
}
xml.writeStartElement(staticTypeTag);
xml.writeAttribute("xmin", QString::number(minX()));
xml.writeAttribute("ymin", QString::number(minY()));
xml.writeAttribute("nx", QString::number(xNumSteps()));
xml.writeAttribute("ny", QString::number(yNumSteps()));
xml.writeAttribute("xstep", QString::number(xStepSize()));
xml.writeAttribute("ystep", QString::number(yStepSize()));
xml.writeTextElement("data", qCompress(qba).toBase64());
saveNameInfo(xml, VNUM|MNUM|XNUM);
xml.writeEndElement();
}
示例4: dump_to_xml
void NPushNormFeetTick::dump_to_xml(QXmlStreamWriter& xml) const
{
xml.writeStartElement("feet_sum");
xml.writeAttribute("tstamp", QString::number(((double)msecsToEpoch)/(double)1000.0, 'f', 3));
xml.writeAttribute("sum", QString::number(pdata.totalRawSum));
// xml.writeAttribute("norm_factor", QString::number(pdata.totalNormFactor));
// xml.writeAttribute("on_air", QString((pdata.totalNormFactor < 0.5)?"true":"false"));
// xml.writeAttribute("valid_cnt", QString::number(pdata.validCount));
// xml.writeAttribute("minLToe", QString::number(pdata.LToe.minVal));
// xml.writeAttribute("minLHeel", QString::number(pdata.LHeel.minVal));
// xml.writeAttribute("minRToe", QString::number(pdata.RToe.minVal));
// xml.writeAttribute("minRHeel", QString::number(pdata.RHeel.minVal));
xml.writeEndElement();//feet_sum
}
示例5: save
void Media::save(QXmlStreamWriter & stream) const
{
stream.writeStartElement("entry");
stream.writeTextElement("categoryRef", category()->name());
QStringList athena = attributes().keys();
foreach(auto hermes, athena)
{
stream.writeStartElement("attribute");
stream.writeAttribute("aname", hermes);
stream.writeCharacters(attribute(hermes));
stream.writeEndElement();
}
示例6: exportXml
void ProgrammationEvenementplsJ::exportXml(QXmlStreamWriter &stream) const
{
stream.writeStartElement("programmation");
stream.writeAttribute("type", "4");
stream.writeTextElement("date",getDate().toString(Qt::ISODate));
stream.writeTextElement("debut",getDebut().toString());
stream.writeTextElement("titre", getTitre());
stream.writeTextElement("description",getDescription());
stream.writeTextElement("datefin",date_fin.toString(Qt::ISODate));
stream.writeTextElement("fin",fin.toString());
stream.writeEndElement();
}
示例7: toXML
bool Node::toXML(QXmlStreamWriter& stream, QProgressDialog * progress, bool strict, QString changesetid)
{
bool OK = true;
if (isVirtual())
return OK;
stream.writeStartElement("node");
Feature::toXML(stream, strict, changesetid);
stream.writeAttribute("lon",COORD2STRING(BBox.topRight().x()));
stream.writeAttribute("lat", COORD2STRING(BBox.topRight().y()));
tagsToXML(stream, strict);
stream.writeEndElement();
if (progress)
progress->setValue(progress->value()+1);
return OK;
}
示例8: vss
void Properties::serializeValueOut( QVariant value, QXmlStreamWriter& stream )
{
if ( value.isValid( ) )
{
stream.writeAttribute( "t", QString::number( value.type( ) ) );
QString vs;
switch ( value.type( ) )
{
case QVariant::Type::SizeF:
{
QSizeF s = value.toSizeF( );
QTextStream vss( &vs );
vss << s.width( ) << " x " << s.height( );
break;
}
default:
vs = value.toString( );
}
stream.writeAttribute( "v", vs );
}
}
示例9: createBusNode
void Doc_Test::createBusNode(QXmlStreamWriter &doc, quint32 id, quint32 val)
{
// Used to test that loading legacy Bus tags won't screw up Doc
doc.writeStartElement("Bus");
doc.writeAttribute("ID", QString::number(id));
doc.writeTextElement("Name", QString("Bus %1").arg(id));
doc.writeTextElement("Value", QString("%1").arg(val));
/* End the <Bus> tag */
doc.writeEndElement();
}
示例10: lock
void
EffectUser::saveFilters( QXmlStreamWriter &project ) const
{
QReadLocker lock( m_effectsLock );
if ( m_filters.size() <= 0 )
return ;
project.writeStartElement( "effects" );
EffectsEngine::EffectList::const_iterator it = m_filters.begin();
EffectsEngine::EffectList::const_iterator ite = m_filters.end();
while ( it != ite )
{
project.writeStartElement( "effect" );
project.writeAttribute( "name", (*it)->effectInstance()->effect()->name() );
project.writeAttribute( "start", QString::number( (*it)->begin() ) );
project.writeAttribute( "end", QString::number( (*it)->end() ) );
project.writeEndElement();
++it;
}
project.writeEndElement();
}
示例11: writeFolderIds
void EwsId::writeFolderIds(QXmlStreamWriter &writer) const
{
if (mType == Distinguished) {
writer.writeStartElement(ewsTypeNsUri, QStringLiteral("DistinguishedFolderId"));
writer.writeAttribute(QStringLiteral("Id"), distinguishedIdNames[mDid]);
writer.writeEndElement();
}
else if (mType == Real) {
#ifdef HAVE_INBOX_FILTERING_WORKAROUND
if (mId == QStringLiteral("INBOX")) {
if (inboxId.isEmpty()) {
writer.writeStartElement(ewsTypeNsUri, QStringLiteral("DistinguishedFolderId"));
writer.writeAttribute(QStringLiteral("Id"), distinguishedIdNames[EwsDIdInbox]);
} else {
writer.writeStartElement(ewsTypeNsUri, QStringLiteral("FolderId"));
writer.writeAttribute(QStringLiteral("Id"), inboxId);
}
} else {
writer.writeStartElement(ewsTypeNsUri, QStringLiteral("FolderId"));
writer.writeAttribute(QStringLiteral("Id"), mId);
}
#else
writer.writeStartElement(ewsTypeNsUri, QStringLiteral("FolderId"));
writer.writeAttribute(QStringLiteral("Id"), mId);
#endif
if (!mChangeKey.isEmpty()) {
writer.writeAttribute(QStringLiteral("ChangeKey"), mChangeKey);
}
writer.writeEndElement();
}
}
示例12: metaObject
void Properties::serializeOut( QXmlStreamWriter& stream )
{
stream.writeStartElement( "properties" ); // <properties>
// Serialize static properties
int pCount = metaObject( )->propertyCount( );
for ( int i = 0; i < pCount; ++i )
{
QMetaProperty metaProperty = metaObject( )->property( i );
QString propertyName = QString( metaProperty.name( ) );
QVariant v = property( propertyName.toLatin1( ) );
stream.writeStartElement( "property" ); // <property>
stream.writeAttribute( "name", propertyName );
serializeValueOut( v, stream );
serializeTimeValuesOut( propertyName, stream );
stream.writeEndElement( ); // </property>
}
// Serialize dynamic properties
QList< QByteArray > dynamicProperties = dynamicPropertyNames( );
for ( int d = 0; d < dynamicProperties.size( ); d++ )
{
QString propertyName = dynamicProperties.at( d );
QVariant v = property( propertyName.toLatin1( ) );
stream.writeStartElement( "property" ); // <property>
stream.writeAttribute( "name", propertyName );
serializeValueOut( v, stream );
if ( isEnum( propertyName ) )
stream.writeAttribute( "isEnum", getEnumValueLabels( propertyName ).join( ',') );
serializeTimeValuesOut( propertyName, stream );
stream.writeEndElement( ); // </property>
}
stream.writeEndElement( ); // </properties>
}
示例13: save
void MapGrid::save(QXmlStreamWriter& xml) const
{
xml.writeEmptyElement("grid");
xml.writeAttribute("color", QColor(color).name());
xml.writeAttribute("display", QString::number(display));
xml.writeAttribute("alignment", QString::number(alignment));
xml.writeAttribute("additional_rotation", QString::number(additional_rotation));
xml.writeAttribute("unit", QString::number(unit));
xml.writeAttribute("h_spacing", QString::number(horz_spacing));
xml.writeAttribute("v_spacing", QString::number(vert_spacing));
xml.writeAttribute("h_offset", QString::number(horz_offset));
xml.writeAttribute("v_offset", QString::number(vert_offset));
xml.writeAttribute("snapping_enabled", snapping_enabled ? "true" : "false");
}
示例14: writeBench
void GaussianBeamWindow::writeBench(QXmlStreamWriter& xmlWriter)
{
xmlWriter.writeTextElement("wavelength", QString::number(m_bench.wavelength()));
xmlWriter.writeTextElement("leftBoundary", QString::number(m_bench.leftBoundary()));
xmlWriter.writeTextElement("rightBoundary", QString::number(m_bench.rightBoundary()));
xmlWriter.writeStartElement("targetBeam");
xmlWriter.writeAttribute("id", "0");
xmlWriter.writeTextElement("position", QString::number(m_bench.targetBeam()->waistPosition()));
xmlWriter.writeTextElement("waist", QString::number(m_bench.targetBeam()->waist()));
xmlWriter.writeTextElement("positionTolerance", QString::number(m_bench.targetBeam()->positionTolerance()));
xmlWriter.writeTextElement("waistTolerance", QString::number(m_bench.targetBeam()->waistTolerance()));
xmlWriter.writeTextElement("minOverlap", QString::number(m_bench.targetBeam()->minOverlap()));
xmlWriter.writeTextElement("overlapCriterion", QString::number(m_bench.targetBeam()->overlapCriterion()));
xmlWriter.writeEndElement();
for (int i = 0; i < m_bench.nFit(); i++)
{
Fit& fit = m_bench.fit(i);
xmlWriter.writeStartElement("beamFit");
xmlWriter.writeAttribute("id", QString::number(i));
xmlWriter.writeTextElement("name", fit.name().c_str());
xmlWriter.writeTextElement("dataType", QString::number(int(fit.dataType())));
xmlWriter.writeTextElement("color", QString::number(fit.color()));
for (int j = 0; j < fit.size(); j++)
{
xmlWriter.writeStartElement("data");
xmlWriter.writeAttribute("id", QString::number(j));
xmlWriter.writeTextElement("position", QString::number(fit.position(j)));
xmlWriter.writeTextElement("value", QString::number(fit.value(j)));
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
}
xmlWriter.writeStartElement("opticsList");
for (int i = 0; i < m_bench.nOptics(); i++)
writeOptics(xmlWriter, m_bench.optics(i));
xmlWriter.writeEndElement();
}
示例15: writeFrameFormat
void QTextOdfWriter::writeFrameFormat(QXmlStreamWriter &writer, QTextFrameFormat format, int formatIndex) const
{
writer.writeStartElement(styleNS, QString::fromLatin1("style"));
writer.writeAttribute(styleNS, QString::fromLatin1("name"), QString::fromLatin1("s%1").arg(formatIndex));
writer.writeAttribute(styleNS, QString::fromLatin1("family"), QString::fromLatin1("section"));
writer.writeEmptyElement(styleNS, QString::fromLatin1("section-properties"));
if (format.hasProperty(QTextFormat::FrameTopMargin))
writer.writeAttribute(foNS, QString::fromLatin1("margin-top"), pixelToPoint(qMax(qreal(0.), format.topMargin())) );
if (format.hasProperty(QTextFormat::FrameBottomMargin))
writer.writeAttribute(foNS, QString::fromLatin1("margin-bottom"), pixelToPoint(qMax(qreal(0.), format.bottomMargin())) );
if (format.hasProperty(QTextFormat::FrameLeftMargin))
writer.writeAttribute(foNS, QString::fromLatin1("margin-left"), pixelToPoint(qMax(qreal(0.), format.leftMargin())) );
if (format.hasProperty(QTextFormat::FrameRightMargin))
writer.writeAttribute(foNS, QString::fromLatin1("margin-right"), pixelToPoint(qMax(qreal(0.), format.rightMargin())) );
writer.writeEndElement(); // style
// TODO consider putting the following properties in a qt-namespace.
// Position position () const
// qreal border () const
// QBrush borderBrush () const
// BorderStyle borderStyle () const
// qreal padding () const
// QTextLength width () const
// QTextLength height () const
// PageBreakFlags pageBreakPolicy () const
}