本文整理汇总了C++中QXmlAttributes::localName方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlAttributes::localName方法的具体用法?C++ QXmlAttributes::localName怎么用?C++ QXmlAttributes::localName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlAttributes
的用法示例。
在下文中一共展示了QXmlAttributes::localName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
示例2: 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;
}
示例3: startElement
bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
{
if(depth == 0) {
Parser::Event *e = new Parser::Event;
QXmlAttributes a;
for(int n = 0; n < atts.length(); ++n) {
QString uri = atts.uri(n);
QString ln = atts.localName(n);
if(a.index(uri, ln) == -1)
a.append(atts.qName(n), uri, ln, atts.value(n));
}
e->setDocumentOpen(namespaceURI, localName, qName, a, nsnames, nsvalues);
nsnames.clear();
nsvalues.clear();
e->setActualString(in->lastString());
in->resetLastData();
eventList.append(e);
in->pause(true);
}
else {
QDomElement e = doc->createElementNS(namespaceURI, qName);
for(int n = 0; n < atts.length(); ++n) {
QString uri = atts.uri(n);
QString ln = atts.localName(n);
bool have;
if(!uri.isEmpty()) {
have = e.hasAttributeNS(uri, ln);
if(qt_bug_have)
have = !have;
}
else
have = e.hasAttribute(ln);
if(!have)
e.setAttributeNS(uri, atts.qName(n), atts.value(n));
}
if(depth == 1) {
elem = e;
current = e;
}
else {
current.appendChild(e);
current = e;
}
}
++depth;
return true;
}
示例4: startElement
bool XMLHandler::startElement( const QString& namespaceURI, const QString& /*localName*/, const QString& qName, const QXmlAttributes& atts )
{
if (m_currentNode->nodeType() == Node::TEXT_NODE)
exitText();
ElementImpl *newElement;
if (namespaceURI.isNull())
newElement = m_doc->createElement(qName);
else
newElement = m_doc->createElementNS(namespaceURI,qName);
// ### handle exceptions
int i;
for (i = 0; i < atts.length(); i++)
newElement->setAttribute(atts.localName(i),atts.value(i));
if (m_currentNode->addChild(newElement)) {
if (m_view)
newElement->attach(m_view);
m_currentNode = newElement;
return TRUE;
}
else {
delete newElement;
return FALSE;
}
}
示例5: startElement
bool SAXConfigurationHandler::startElement ( const QString & namespaceURI,
const QString & localName, const QString & qName,
const QXmlAttributes & atts ) {
int idx = qName.find ( ':' );
QString prefix = "";
if ( idx > 0 ) {
prefix = qName.left ( idx );
}
ConfigurationPtr c(new DefaultConfiguration( localName,
getLocationString(), namespaceURI, prefix ));
// if processing the toplevel item simply push it, otherwise link it
// with the parent
if( d->configuration.isNull() ) {
d->configuration = c;
} else {
ConfigurationPtr parent = d->elements.top();
parent->addChild( c );
}
// process attributes
for( int i = 0; i < atts.length(); i ++ ) {
c->setAttribute( atts.localName( i ), atts.value( i ) );
}
// push currently built configuration to the stack
d->elements.push( c );
return true;
}
示例6: startElement
bool ConfigHandler::startElement( const QString &, const QString &, const QString &name, const QXmlAttributes &attrs )
{
if (inConf && name == "tab") {
for(int i = 0; i < attrs.count(); i++) {
if (attrs.localName(i) == "name")
tName = attrs.value(i);
else if (attrs.localName(i) == "dir")
tDir = attrs.value(i);
else if (attrs.localName(i) == "command")
tCommand = attrs.value(i);
}
}
else if ( name == "krails" ) {
inConf = true;
}
return true;
}
示例7: 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();
}
示例8: 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;
}
示例9: 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;
}
示例10: 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;
}
}
示例11: copyAttributes
void cElement::copyAttributes( const QXmlAttributes& attributes )
{
freeAttributes();
attrCount_ = attributes.count();
if ( attrCount_ > 0 )
{
this->attributes = new stAttribute * [attrCount_];
for ( unsigned int i = 0; i < attrCount_; ++i )
{
this->attributes[i] = new stAttribute;
this->attributes[i]->name = attributes.localName( i );
this->attributes[i]->value = attributes.value( i );
}
}
}
示例12: startElement
bool PropertyParser::startElement( const QString & /* namespaceUrl */,
const QString & /* localName */, const QString& elementName,
const QXmlAttributes& attribute )
{
// If debugging, print each element and its attributes as encountered.
m_indent += " ";
if ( m_debug )
{
std::cout << m_indent << "<" << elementName;
for ( int id = 0;
id < attribute.length();
id++ )
{
std::cout << " " << attribute.localName(id) << "=\""
<< attribute.value(id) << "\"";
}
std::cout << " >" << std::endl;
}
// Skip all elements until <BehavePlus> is found.
if ( ! m_elements )
{
if ( elementName == "BehavePlus" )
{
push( elementName );
return( true );
}
trError( "PropertyParser:unknownDocument" );
return( false );
}
// <property> elements
if ( elementName == "property" )
{
push( elementName );
if ( ! handleProperty( elementName, attribute ) )
{
return( false );
}
}
// Ignore all other tags
else
{
trError( "PropertyParser:unknownElement", elementName );
return( false );
}
return( true );
}
示例13: toKeyword
void FbReadHandler::TextHandler::Init(const QString &name, const QXmlAttributes &atts)
{
Keyword key = toKeyword(name);
writer().writeStartElement(m_tag);
int count = atts.count();
for (int i = 0; i < count; i++) {
QString name = atts.qName(i);
switch (key) {
case Anchor: { if (atts.localName(i) == "href") name = "href"; break; }
case Image: { if (atts.localName(i) == "href") name = "src"; break; }
default: ;
}
writer().writeAttribute(name, atts.value(i));
}
if (name == "empty-line") {
writer().writeEmptyElement("br");
m_empty = false;
}
}
示例14: startElement
bool TrackReader::startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts)
{
Q_UNUSED(qName)
const QString eName = myQName(namespaceURI, localName);
d->currentElements << eName;
rebuildElementPath();
const QString& ePath = d->currentElementPath;
if (ePath == QString::fromLatin1("gpx:gpx/gpx:trk/gpx:trkseg/gpx:trkpt"))
{
qreal lat = 0.0;
qreal lon = 0.0;
bool haveLat = false;
bool haveLon = false;
for (int i = 0; i < atts.count(); ++i)
{
const QString attName = myQName(atts.uri(i), atts.localName(i));
const QString attValue = atts.value(i);
if (attName == QString::fromLatin1("lat"))
{
lat = attValue.toDouble(&haveLat);
}
else if (attName == QString::fromLatin1("lon"))
{
lon = attValue.toDouble(&haveLon);
}
}
if (haveLat&&haveLon)
{
d->currentDataPoint.coordinates.setLatLon(lat, lon);
}
}
else if (ePath == QString::fromLatin1("gpx:gpx"))
{
d->verifyFoundGPXElement = true;
}
return true;
}
示例15: startElement
bool XmlParser::startElement( const QString & /* namespaceUri */,
const QString & /* localName */, const QString& elementName,
const QXmlAttributes& attribute )
{
// If debugging, print each element and its attributes as encountered.
m_indent += " ";
if ( m_debug )
{
std::cout << m_indent << "<" << elementName;
for ( int id = 0;
id < attribute.length();
id++ )
{
std::cout << " " << attribute.localName(id) << "=\""
<< attribute.value(id) << "\"";
}
std::cout << " >" << std::endl;
}
return( true );
}