本文整理汇总了C++中QXmlAttributes::count方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlAttributes::count方法的具体用法?C++ QXmlAttributes::count怎么用?C++ QXmlAttributes::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlAttributes
的用法示例。
在下文中一共展示了QXmlAttributes::count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
bool MapParser::startElement(const QString&, const QString&, const QString& p_qName, const QXmlAttributes& p_atts)
{
if (p_qName == "Arena")
{
int nbRows = 0;
int nbColumns = 0;
// Initialize the number of rows and columns
for (int i = 0; i < p_atts.count(); ++i)
{
if (p_atts.qName(i) == "rowCount")
{
nbRows = p_atts.value(i).toInt();
}
if (p_atts.qName(i) == "colCount")
{
nbColumns = p_atts.value(i).toInt();
}
//TODO:check for the right arenaFileVersion
//if (p_atts.qName(i) == "arenaFileVersion")
//{
// m_arenaFileVersion = p_atts.value(i).toInt();
//}
}
// Create the Arena matrix
m_arena->init(nbRows, nbColumns);
// initialize random generator
qsrand(QDateTime::currentDateTime().toTime_t());
}
return true;
}
示例2: attrName
bool KWord13Parser::startElementFrame(const QString& name, const QXmlAttributes& attributes, KWord13StackItem *stackItem)
{
if (stackItem->elementType == KWord13TypeFrameset || stackItem->elementType == KWord13TypePictureFrameset) {
stackItem->elementType = KWord13TypeEmpty;
if (stackItem->m_currentFrameset) {
const int num = ++stackItem->m_currentFrameset->m_numFrames;
for (int i = 0; i < attributes.count(); ++i) {
QString attrName(name);
attrName += ':';
attrName += QString::number(num);
attrName += ':';
attrName += attributes.qName(i);
stackItem->m_currentFrameset->m_frameData[ attrName ] = attributes.value(i);
kDebug(30520) << "FrameData:" << attrName << " =" << attributes.value(i);
}
} else {
kError(30520) << "Data of <FRAMESET> not found";
return false;
}
} else if (stackItem->elementType != KWord13TypeUnknownFrameset) {
kError(30520) << "<FRAME> not child of <FRAMESET>";
return false;
}
return true;
}
示例3: tabStop
void StyleReader::tabStop(const QXmlAttributes& attrs)
{
if (currentStyle->target() == "paragraph")
{
gtParagraphStyle* pstyle = dynamic_cast<gtParagraphStyle*>(currentStyle);
assert(pstyle != NULL);
QString pos = NULL;
QString type = NULL;
for (int i = 0; i < attrs.count(); ++i)
{
if (attrs.localName(i) == "style:position")
pos = attrs.value(i);
else if (attrs.localName(i) == "style:type")
type = attrs.value(i);
}
if (!pos.isNull())
{
if (type.isNull())
type = "left";
double posd = getSize(pos);
if (type == "left")
pstyle->setTabValue(posd, LEFT_T);
else if (type == "right")
pstyle->setTabValue(posd, RIGHT_T);
else if (type == "center")
pstyle->setTabValue(posd, CENTER_T);
else
pstyle->setTabValue(posd, CENTER_T);
}
}
}
示例4: startElement
bool startElement( const QString& nsURI, const QString& locName, const QString& qName,
const QXmlAttributes& qattr)
{
Xml_attr attr;
for (int i=0; i < qattr.count(); ++i)
attr[qattr.qName(i)] = fromSTLString(qattr.value(i).toUtf8().data());
dig->begin(qName, attr);
return true;
}
示例5: startElement
bool KEYBMAPParser::startElement( const QString&, const QString&, const QString &name, const QXmlAttributes &attrs )
{
QString desc = "";
QString modifier="";
int scancode,masterscancode,delay,x,y,w,h;
View view=FRONTview;
bool ok = false;
scancode=masterscancode=delay=x=y=w=h=0;
if( inKeyboard && name == "KEY" )
{
for( int i=0; i<attrs.count(); i++ )
{
if( attrs.localName( i ) == "description" )
desc = attrs.value( i );
else if( attrs.localName( i ) == "scancode" )
scancode = attrs.value( i ).toInt(&ok,16);
else if( attrs.localName( i ) == "left" )
x = attrs.value( i ).toInt(&ok,10);
else if( attrs.localName( i ) == "top" )
y = attrs.value( i ).toInt(&ok,10);
else if( attrs.localName( i ) == "width" )
w = attrs.value( i ).toInt(&ok,10);
else if( attrs.localName( i ) == "height" )
h = attrs.value( i ).toInt(&ok,10);
else if( attrs.localName( i ) == "masterscancode" )
masterscancode = attrs.value( i ).toInt(&ok,16);
else if( attrs.localName( i ) == "delay" ) {
delay = attrs.value( i ).toInt(&ok,10);
qWarning()<<"delay="<<delay;
}
else if( attrs.localName( i ) == "modifier" )
modifier = attrs.value( i );
else if( attrs.localName( i ) == "view" ) {
if (attrs.value( i ) == "FRONT") view = FRONTview;
if (attrs.value( i ) == "TOP") view = TOPview;
if (attrs.value( i ) == "LEFT") view = LEFTview;
if (attrs.value( i ) == "RIGHT") view = RIGHTview;
if (attrs.value( i ) == "BACK") view = BACKview;
if (attrs.value( i ) == "BOTTOM") view = BOTTOMview;
}
}
Parent->Keys.append(CKey(scancode,desc,QRect(x,y,w,h),masterscancode,modifier,view,delay));
AddLog(LOG_KEYBOARD,mainwindow->tr("XML Read key : %1, scan=0x%2 , Rect=(%3,%4,%5,%6), mscan=0x%7, mod=%8").
arg(desc).
arg(scancode,2,16,QChar('0')).
arg(x).arg(y).arg(w).arg(h).
arg(masterscancode,2,16,QChar('0')).
arg(modifier));
}
else if( name == "Keyboard" )
inKeyboard = true;
return true;
}
示例6: QString
QString FbXmlHandler::NodeHandler::Value(const QXmlAttributes &attributes, const QString &name)
{
int count = attributes.count();
for (int i = 0; i < count; ++i ) {
if (attributes.localName(i).compare(name, Qt::CaseInsensitive) == 0) {
return attributes.value(i);
}
}
return QString();
}
示例7: startElement
bool PokedexParser::startElement(const QString &//namespaceURI
,
const QString &//localName
,
const QString &qName,
const QXmlAttributes &attrs)
{
if (qName == "pokedex")
this->inPokedex_ = true;
else if (qName == "pokemon")
{
if ((attrs.count() >= 1) && (attrs.qName(0) == "id"))
tmpPok_ = new Pokemon(attrs.value(0).toInt());
else
tmpPok_ = NULL;
}
else if (qName == "evolution")
{
if ((attrs.count() >= 1) && (attrs.qName(0) == "id"))
tmpEvo_ = new Evolution(attrs.value(0).toInt());
inEvo_ = true;
}
else if (qName == "move")
{
if ((attrs.count() >= 1) && (attrs.qName(0) == "type"))
{
if (attrs.value(0) == "level-up")
{
tmpLevel_ = new Level();
inLevel_ = true;
}
else if (attrs.value(0) == "TM/HM")
{
tmpTm_hm_ = new Tm_hm();
inTmHm_ = true;
}
else if (attrs.value(0) == "egg")
inEggs_ = true;
}
}
return true;
}
示例8: startElement
bool XMLSettingParser::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes)
{
if (qName.toLower() == "settings")
{
for (int i = 0; i < attributes.count(); i++)
{
m_map[attributes.qName(i)] = attributes.value(i);
}
}
return true;
}
示例9: startElement
bool XmlHandler::startElement(const QString &/*namespaceURI*/, const QString &/*localName*/,
const QString &qName, const QXmlAttributes &attributes)
{
if( qName == this->qName ) {
IsoCodeEntry entry;
for(int i=0; i<attributes.count(); i++) {
entry.insert(attributes.qName(i), attributes.value(i));
}
isoEntryList.append(entry);
}
return true;
}
示例10: startElement
bool LibraryParser::startElement( const QString&, const QString&, const QString &name, const QXmlAttributes &attrs)
{
// start of a new library definition
buffer.clear();
if(name == "library") {
library = new Library();
for(int i=0; i<attrs.count(); i++) {
if (attrs.qName(i) == "name") library->name = attrs.value(i);
}
}
return true;
}
示例11: formatAttributes
QString ContentHandler::formatAttributes(const QXmlAttributes &atts)
{
QString result;
for (int i = 0, cnt = atts.count(); i < cnt; ++i) {
if (i != 0) result += ", ";
result += "{localName=\"" + escapeStr(atts.localName(i))
+ "\", qName=\"" + escapeStr(atts.qName(i))
+ "\", uri=\"" + escapeStr(atts.uri(i))
+ "\", type=\"" + escapeStr(atts.type(i))
+ "\", value=\"" + escapeStr(atts.value(i)) + "\"}";
}
return result;
}
示例12: startElement
bool nftrcreader::startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs)
{
if (name == "name")
inName = true;
else if (name == "file")
inFile = true;
else if (name == "tnail")
inTNail = true;
else if (name == "img")
inImg = true;
else if (name == "psize")
inPSize = true;
else if (name == "color")
inColor = true;
else if (name == "descr")
inDescr = true;
else if (name == "usage")
inUsage = true;
else if (name == "scribus_version")
inScribusVersion = true;
else if (name == "date")
inDate = true;
else if (name == "author")
inAuthor = true;
else if (name == "email")
inEmail = true;
if (name == "template") { // new template starts here
inTemplate = true;
QString category;
QString enCat;
for (int i = 0; i < attrs.count(); i++)
{
if (attrs.localName(i) == "category")
{
category = getCategory(attrs.value(i));
enCat = attrs.value(i);
}
}
tmpTemplate = new nfttemplate(new QFile(currentFile), category); // create a new template
tmpTemplate->enCategory = enCat;
}
if (name == "settings")
inSettings = true;
return true;
}
示例13: defaultStyle
void StyleReader::defaultStyle(const QXmlAttributes& attrs)
{
currentStyle = NULL;
for (int i = 0; i < attrs.count(); ++i)
if (attrs.localName(i) == "style:family")
if (attrs.value(i) == "paragraph")
{
gtParagraphStyle* pstyle = new gtParagraphStyle(*(writer->getDefaultStyle()));
pstyle->setDefaultStyle(true);
currentStyle = dynamic_cast<gtStyle*>(pstyle);
currentStyle->setName("default-style");
readProperties = true;
defaultStyleCreated = true;
}
}
示例14: startElement
bool ImportHandler::startElement (const QString &, const QString &, const QString &qName, const QXmlAttributes &atts ) {
m_data = "";
if (qName == "template")
inTemplate = true;
if (! inTemplate)
return true;
//save sttributes to a map
m_attributes.clear();
for (int i = 0; i < atts.count(); ++i)
m_attributes[atts.qName(i)] = atts.value(i);
return true;
}
示例15: startElement
bool startElement(const QString & szNamespaceUri, const QString & szLocalName, const QString & szQualifiedName, const QXmlAttributes & attrs) override
{
KviKvsVariant ret;
KviKvsVariantList par;
par.setAutoDelete(true);
par.append(new KviKvsVariant(szQualifiedName));
KviKvsHash * pHash = new KviKvsHash();
par.append(new KviKvsVariant(pHash));
par.append(new KviKvsVariant(szNamespaceUri));
par.append(new KviKvsVariant(szLocalName));
int c = attrs.count();
for(int i = 0; i < c; i++)
pHash->set(attrs.qName(i), new KviKvsVariant(attrs.value(i)));
if(!m_pReader->callFunction(m_pReader, "onElementStart", &ret, &par))
return kvsCodeFailure();
return handleKvsCallReturnValue(&ret);
}