本文整理汇总了C++中QXmlStreamWriter::device方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlStreamWriter::device方法的具体用法?C++ QXmlStreamWriter::device怎么用?C++ QXmlStreamWriter::device使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlStreamWriter
的用法示例。
在下文中一共展示了QXmlStreamWriter::device方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteChannel
void WriteChannel (QXmlStreamWriter& w,
const ChannelShort& cs, const QList<Item_ptr>& items)
{
w.writeStartElement ("section");
w.writeAttribute ("id", QString::number (cs.ChannelID_));
w.writeStartElement ("title");
w.writeTextElement ("p", FixContents (cs.Title_));
w.writeEndElement ();
w.writeTextElement ("annotation",
Export2FB2Dialog::tr ("%n unread item(s)", "", cs.Unread_));
Q_FOREACH (Item_ptr item, items)
{
w.writeStartElement ("title");
w.writeStartElement ("p");
w.writeComment ("p");
w.device ()->write (FixContents (item->Title_).toUtf8 ());
w.writeEndElement ();
w.writeEndElement ();
bool hasDate = item->PubDate_.isValid ();
bool hasAuthor = item->Author_.size ();
if (hasDate || hasAuthor)
{
w.writeStartElement ("epigraph");
if (hasDate)
w.writeTextElement ("p",
Export2FB2Dialog::tr ("Published on %1")
.arg (item->PubDate_.toString ()));
if (hasAuthor)
w.writeTextElement ("p",
Export2FB2Dialog::tr ("By %1")
.arg (item->Author_));
w.writeEndElement ();
w.writeEmptyElement ("empty-line");
}
w.writeStartElement ("p");
w.writeComment ("p");
w.device ()->write (FixContents (item->Description_).toUtf8 ());
w.writeEndElement ();
w.writeEmptyElement ("empty-line");
}
示例2: appendComponent
void appendComponent( QXmlStreamWriter &stream, const Billon &billon, const uint &firstSlicePos, const int &index )
{
const uint &width = billon.n_cols;
const uint &height = billon.n_rows;
const uint &depth = billon.n_slices;
uint i, j, k;
stream.writeStartElement("component");
stream.writeAttribute("id",QString::number(index));
stream.writeAttribute("valmax",QString::number(billon.maxValue()));
stream.writeAttribute("valmin",QString::number(billon.minValue()));
//coord minimum
stream.writeStartElement("coord");
stream.writeAttribute("name","minimum");
stream.writeTextElement("x",QString::number(0));
stream.writeTextElement("y",QString::number(0));
stream.writeTextElement("z",QString::number(firstSlicePos));
stream.writeEndElement();
//coord maximum
stream.writeStartElement("coord");
stream.writeAttribute("name","maximum");
stream.writeTextElement("x",QString::number(width-1));
stream.writeTextElement("y",QString::number(height-1));
stream.writeTextElement("z",QString::number(firstSlicePos+billon.n_slices-1));
stream.writeEndElement();
//binarydata
stream.writeStartElement("binarydata");
stream.writeAttribute("encoding","16");
stream.writeCharacters("");
QDataStream voxelStream(stream.device());
for ( k=0; k<depth; ++k )
{
const Slice &slice = billon.slice(k);
for ( j=0; j<height; ++j )
{
for ( i=0; i<width; ++i )
{
voxelStream << (qint16)(slice.at(j,i));
}
}
}
stream.writeEndElement();
stream.writeEndElement();
}
示例3: sipConvertFromType
static PyObject *meth_QXmlStreamWriter_device(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
QXmlStreamWriter *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QXmlStreamWriter, &sipCpp))
{
QIODevice *sipRes;
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp->device();
Py_END_ALLOW_THREADS
return sipConvertFromType(sipRes,sipType_QIODevice,NULL);
}
}