本文整理汇总了C++中QDomAttr::value方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomAttr::value方法的具体用法?C++ QDomAttr::value怎么用?C++ QDomAttr::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDomAttr
的用法示例。
在下文中一共展示了QDomAttr::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Constraint
ConstraintTypes::PlaylistLength::PlaylistLength( QDomElement& xmlelem, ConstraintNode* p )
: Constraint( p )
, m_length( 30 )
, m_comparison( CompareNumEquals )
, m_strictness( 1.0 )
{
QDomAttr a;
a = xmlelem.attributeNode( "length" );
if ( !a.isNull() ) {
m_length = a.value().toInt();
/* after 2.3.2, what was the PlaylistLength constraint became the
* PlaylistDuration constraint, so this works around the instance when
* a user loads an XML file generated with the old code -- sth*/
if ( m_length > 1000 )
m_length /= 240000;
}
a = xmlelem.attributeNode( "comparison" );
if ( !a.isNull() )
m_comparison = a.value().toInt();
a = xmlelem.attributeNode( "strictness" );
if ( !a.isNull() )
m_strictness = a.value().toDouble();
}
示例2: Constraint
ConstraintTypes::PlaylistDuration::PlaylistDuration( QDomElement& xmlelem, ConstraintNode* p )
: Constraint( p )
, m_duration( 0 )
, m_comparison( CompareNumEquals )
, m_strictness( 1.0 )
{
QDomAttr a;
a = xmlelem.attributeNode( "duration" );
if ( !a.isNull() ) {
m_duration = a.value().toInt();
} else {
// Accommodate schema change when PlaylistLength became PlaylistDuration
a = xmlelem.attributeNode( "length" );
if ( !a.isNull() )
m_duration = a.value().toInt();
}
a = xmlelem.attributeNode( "comparison" );
if ( !a.isNull() )
m_comparison = a.value().toInt();
a = xmlelem.attributeNode( "strictness" );
if ( !a.isNull() )
m_strictness = a.value().toDouble();
}
示例3: EMalformedPolicy
void
Pattern::xmlAddTransition(QDomElement _element)
{
// a transition must have a message tag
QDomAttr attrMessage = _element.attributeNode("message");
if (attrMessage.isNull() ||
attrMessage.value().isEmpty()) {
throw BehaviourEngine::
EMalformedPolicy(CORBA::string_dup("Transition without message."));
}
std::string message = attrMessage.value().latin1();
// a transition must have a target tag
QDomAttr attrPattern = _element.attributeNode("target");
if (attrPattern.isNull() ||
attrPattern.value().isEmpty()) {
throw BehaviourEngine::
EMalformedPolicy(CORBA::string_dup("Transition without target."));
}
std::string target = attrPattern.value().latin1();
// internal transitions are only possible within some policy
if (parent_ == NULL)
throw BehaviourEngine::
EMalformedPolicy(CORBA::string_dup("Internal transition at top level."));
parent_->transitions_.insert(std::make_pair(std::make_pair(getName(),
message),
target));
}
示例4: loadLine
void LevelLoader::loadLine(QDomElement lineNode)
{
// Reading the line number
QDomAttr attribute = lineNode.attributeNode(QStringLiteral("Number"));
QDomElement attributeNode = lineNode.firstChildElement(QStringLiteral("Number"));
if (!attribute.isNull()) {
m_lineNumber = attribute.value().toInt();
} else if (!attributeNode.isNull()) {
m_lineNumber = attributeNode.text().toInt();
} else {
// Standard line numbering: load next line
m_lineNumber++;
}
// Reading the brick information
attribute = lineNode.attributeNode(QStringLiteral("Bricks"));
attributeNode = lineNode.firstChildElement(QStringLiteral("Bricks"));
QString line;
if (!attribute.isNull()) {
line = attribute.value();
} else if (!attributeNode.isNull()) {
line = attributeNode.text();
} else {
line = lineNode.text();
}
if (line.size() > WIDTH) {
qCritical() << "Invalid levelset " << m_levelname << ": too many bricks in line "
<< m_lineNumber << endl;
}
emit newLine(line, m_lineNumber);
}
示例5: Constraint
ConstraintTypes::PlaylistFileSize::PlaylistFileSize( QDomElement& xmlelem, ConstraintNode* p )
: Constraint( p )
, m_size( 700 )
, m_unit( 1 )
, m_comparison( CompareNumEquals )
, m_strictness( 1.0 )
{
QDomAttr a;
a = xmlelem.attributeNode( "size" );
if ( !a.isNull() )
m_size = a.value().toInt();
a = xmlelem.attributeNode( "unit" );
if ( !a.isNull() )
m_unit = a.value().toInt();
a = xmlelem.attributeNode( "comparison" );
if ( !a.isNull() )
m_comparison = a.value().toInt();
a = xmlelem.attributeNode( "strictness" );
if ( !a.isNull() )
m_strictness = a.value().toDouble();
}
示例6: Unmarshall
void Block::Unmarshall( QDomElement& blockElement, Level* level )
{
QDomAttr blockRowAttr = blockElement.attributeNode(BLOCK_ROW_ATTR);
QDomAttr blockColumnAttr = blockElement.attributeNode(BLOCK_COLUMN_ATTR);
UrAsset::setRow( blockRowAttr.value().toUInt() );
UrAsset::setColumn( blockColumnAttr.value().toUInt() );
UrAsset::calculateLevelEditorPosition(level->Row);
}
示例7: setAttribute
void Language::setAttribute( QDomAttr &attr) {
if(attr.localName().compare("Value", Qt::CaseInsensitive)==0) {
setValue(attr.value());
return;
}
if(attr.localName().compare("Lang", Qt::CaseInsensitive)==0) {
setLang(attr.value());
return;
}
}
示例8: setAttribute
void PreviouslyShown::setAttribute( QDomAttr &attr) {
if(attr.localName().compare("Channel", Qt::CaseInsensitive)==0) {
setChannel(attr.value());
return;
}
if(attr.localName().compare("Start", Qt::CaseInsensitive)==0) {
setStart(attr.value());
return;
}
}
示例9: if
void
operator <<= (Miro::SensorGroupIDL& group, const QDomNode& node)
{
if (!node.isNull()) {
// set sensor defaults
Miro::SensorPositionIDL sensor;
sensor.masked = false;
QDomNamedNodeMap map = node.attributes();
QDomNode n;
n = map.namedItem("height");
if (!n.isNull()) {
QDomAttr attr = n.toAttr();
if (!attr.isNull())
sensor.height = attr.value().toInt();
}
n = map.namedItem("distance");
if (!n.isNull()) {
QDomAttr attr = n.toAttr();
if (!attr.isNull())
sensor.distance =attr.value().toInt();
}
n = map.namedItem("alpha");
if (!n.isNull()) {
QDomAttr attr = n.toAttr();
if (!attr.isNull())
sensor.alpha = deg2Rad(attr.value().toDouble());
}
n = map.namedItem("beta");
if (!n.isNull()) {
QDomAttr attr = n.toAttr();
if (!attr.isNull())
sensor.beta = deg2Rad(attr.value().toDouble());
}
n = map.namedItem("gamma");
if (!n.isNull()) {
QDomAttr attr = n.toAttr();
if (!attr.isNull())
sensor.gamma = deg2Rad(attr.value().toDouble());
}
QDomNode n1 = node.firstChild();
while(!n1.isNull() ) {
if (n1.nodeName() == "description") {
group.description <<= n1;
}
else if (n1.nodeName() == "sensor") {
group.sensor.length(group.sensor.length() + 1);
group.sensor[group.sensor.length() - 1] = sensor;
group.sensor[group.sensor.length() - 1] <<= n1;
}
n1 = n1.nextSibling();
}
}
}
示例10: importKeySet
void Prefs_KeyboardShortcuts::importKeySet(QString filename)
{
searchTextLineEdit->clear();
QFileInfo fi = QFileInfo(filename);
if (fi.exists())
{
//import the file into qdomdoc
QDomDocument doc( "keymapentries" );
QFile file1( filename );
if ( !file1.open( QIODevice::ReadOnly ) )
return;
QTextStream ts(&file1);
ts.setCodec("UTF-8");
QString errorMsg;
int eline;
int ecol;
if ( !doc.setContent( ts.readAll(), &errorMsg, &eline, &ecol ))
{
qDebug("%s", QString("Could not open key set file: %1\nError:%2 at line: %3, row: %4").arg(filename).arg(errorMsg).arg(eline).arg(ecol).toLatin1().constData());
file1.close();
return;
}
file1.close();
//load the file now
QDomElement docElem = doc.documentElement();
if (docElem.tagName()=="shortcutset" && docElem.hasAttribute("name"))
{
QDomAttr keysetAttr = docElem.attributeNode( "name" );
//clear current menu entries
for (QMap<QString,Keys>::Iterator it=keyMap.begin(); it!=keyMap.end(); ++it)
it.value().keySequence = QKeySequence();
//load in new set
QDomNode n = docElem.firstChild();
while( !n.isNull() )
{
QDomElement e = n.toElement(); // try to convert the node to an element.
if( !e.isNull() )
{
if (e.hasAttribute("name") && e.hasAttribute( "shortcut" ))
{
QDomAttr nameAttr = e.attributeNode( "name" );
QDomAttr shortcutAttr = e.attributeNode( "shortcut" );
if (keyMap.contains(nameAttr.value()))
keyMap[nameAttr.value()].keySequence=QKeySequence(shortcutAttr.value());
}
}
n = n.nextSibling();
}
}
}
insertActions();
}
示例11: loadGift
void LevelLoader::loadGift(QDomElement giftNode)
{
bool nodeTextRead = false;
// Reading the brick type
QDomAttr attribute = giftNode.attributeNode(QStringLiteral("Type"));
QDomElement attributeNode = giftNode.firstChildElement(QStringLiteral("Type"));
QString giftType;
if (!attribute.isNull()) {
giftType = attribute.value();
} else if (!attributeNode.isNull()) {
giftType = attributeNode.text();
nodeTextRead = true;
} else {
giftType = giftNode.text();
nodeTextRead = true;
}
// Reading number of gifts to be distributed. If not specified one gift is placed.
attribute = giftNode.attributeNode(QStringLiteral("Count"));
attributeNode = giftNode.firstChildElement(QStringLiteral("Count"));
int times = 1;
bool ok = true;
if (!attribute.isNull()) {
times = attribute.value().toInt(&ok);
} else if (!attributeNode.isNull()) {
times = attributeNode.text().toInt(&ok);
nodeTextRead = true;
} else if (!nodeTextRead) {
times = giftNode.text().toInt(&ok);
if (!ok) {
times = 1;
}
}
// If only one brick to be placed: see if position is given
QString position;
if (times == 1) {
attribute = giftNode.attributeNode(QStringLiteral("Position"));
attributeNode = giftNode.firstChildElement(QStringLiteral("Position"));
if (!attribute.isNull()) {
position = attribute.value();
} else if (!attributeNode.isNull()) {
position = attributeNode.text();
nodeTextRead = true;
} else if (!nodeTextRead && giftNode.text().contains(QLatin1Char(','))) {
position = giftNode.text();
nodeTextRead = true;
}
}
emit newGift(giftType, times, position);
}
示例12: parse
void UBOEmbedParser::parse(const QString& html)
{
mContents.clear();
QString query = "<link([^>]*)>";
QRegExp exp(query);
QStringList results;
int count = 0;
int pos = 0;
while ((pos = exp.indexIn(html, pos)) != -1) {
++count;
pos += exp.matchedLength();
QStringList res = exp.capturedTexts();
if("" != res.at(1)) {
results << res.at(1);
}
}
QVector<QString> oembedUrls;
if(2 <= results.size()) {
for(int i=1; i<results.size(); i++) {
if("" != results.at(i)) {
QString qsNode = QString("<link%0>").arg(results.at(i));
QDomDocument domDoc;
domDoc.setContent(qsNode);
QDomNode linkNode = domDoc.documentElement();
// At this point, we have a node that is the <link> element. Now we have to parse its attributes
// in order to check if it is a oEmbed node or not
QDomAttr typeAttribute = linkNode.toElement().attributeNode("type");
if(typeAttribute.value().contains("oembed")) {
// The node is an oembed one! We have to get the url and the type of oembed encoding
QDomAttr hrefAttribute = linkNode.toElement().attributeNode("href");
QString url = hrefAttribute.value();
oembedUrls.append(url);
}
}
}
}
mPending = oembedUrls.size();
if(0 == mPending) {
emit oembedParsed(mContents);
} else {
// Here we start the parsing (finally...)!
for(int i=0; i<oembedUrls.size(); i++) {
emit parseContent(oembedUrls.at(i));
}
}
}
示例13: setAttribute
void Programme::setAttribute( QDomAttr &attr) {
if(attr.localName().compare("VpsStart", Qt::CaseInsensitive)==0) {
setVpsStart(attr.value());
return;
}
if(attr.localName().compare("Channel", Qt::CaseInsensitive)==0) {
setChannel(attr.value());
return;
}
if(attr.localName().compare("Showview", Qt::CaseInsensitive)==0) {
setShowview(attr.value());
return;
}
if(attr.localName().compare("Start", Qt::CaseInsensitive)==0) {
setStart(attr.value());
return;
}
if(attr.localName().compare("Stop", Qt::CaseInsensitive)==0) {
setStop(attr.value());
return;
}
if(attr.localName().compare("Clumpidx", Qt::CaseInsensitive)==0) {
setClumpidx(attr.value());
return;
}
if(attr.localName().compare("PdcStart", Qt::CaseInsensitive)==0) {
setPdcStart(attr.value());
return;
}
if(attr.localName().compare("Videoplus", Qt::CaseInsensitive)==0) {
setVideoplus(attr.value());
return;
}
}
示例14: writeConfig
void PrefPortaudio::writeConfig()
{
/* We can do better error control here, can't we? */
ISettings *_settings = new ISettings();
QDomElement cfg = _settings->getConfigNode("portaudio.conf");
QDomNodeList nl = cfg.elementsByTagName("param");
for (int i = 0; i < nl.count(); i++) {
QDomAttr var = nl.at(i).toElement().attributeNode("name");
QDomAttr val = nl.at(i).toElement().attributeNode("value");
if (var.value() == "indev") {
val.setValue(QString::number(_ui->PaIndevCombo->itemData(_ui->PaIndevCombo->currentIndex(), Qt::UserRole).toInt()));
}
if (var.value() == "outdev") {
val.setValue(QString::number(_ui->PaOutdevCombo->itemData(_ui->PaOutdevCombo->currentIndex(), Qt::UserRole).toInt()));
}
if (var.value() == "ringdev") {
val.setValue(QString::number(_ui->PaRingdevCombo->itemData(_ui->PaRingdevCombo->currentIndex(), Qt::UserRole).toInt()));
}
if (var.value() == "ring-file") {
val.setValue(_ui->PaRingFileEdit->text());
}
if (var.value() == "ring-interval") {
val.setValue(QString::number(_ui->PaRingIntervalSpin->value()));
}
if (var.value() == "hold-file") {
val.setValue(_ui->PaHoldFileEdit->text());
}
if (var.value() == "cid-name") {
val.setValue(_ui->PaCallerIdNameEdit->text());
}
if (var.value() == "cid-num") {
val.setValue(_ui->PaCallerIdNumEdit->text());
}
if (var.value() == "sample-rate") {
val.setValue(_ui->PaSampleRateEdit->text());
}
if (var.value() == "codec-ms") {
val.setValue(_ui->PaCodecMSEdit->text());
}
/* Not used currently
if (var.value() == "dialplan") {
val.setValue();
}
if (var.value() == "timer-name") {
val.setValue();
}*/
}
/* Save the config to the file */
_settings->setConfigNode(cfg, "portaudio.conf");
}
示例15: scanForAttributes
void XSchemaSimpleTypeUnion::scanForAttributes(QDomAttr &attribute, void * /*context*/)
{
QString name = attribute.nodeName();
if(name == IO_GENERIC_ID) {
_id = attribute.value() ;
} else if(name == IO_SIMPLETYPE_UNION_ATTR_MEMBERTYPES) {
_memberTypes = attribute.value() ;
} else {
if(!readOtherAttributes(attribute)) {
raiseError(this, attribute, false);
}
}
}