当前位置: 首页>>代码示例>>C++>>正文


C++ QDomDocument::isNull方法代码示例

本文整理汇总了C++中QDomDocument::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QDomDocument::isNull方法的具体用法?C++ QDomDocument::isNull怎么用?C++ QDomDocument::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDomDocument的用法示例。


在下文中一共展示了QDomDocument::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: readXML

void QLCFile_Test::readXML()
{
    QDomDocument doc;

    doc = QLCFile::readXML(QString());
    QVERIFY(doc.isNull() == true);

    doc = QLCFile::readXML("foobar");
    QVERIFY(doc.isNull() == true);

    doc = QLCFile::readXML("broken.xml");
    QVERIFY(doc.isNull() == false);
    QCOMPARE(doc.firstChild().toElement().tagName(), QString("Workspace"));
    QCOMPARE(doc.firstChild().firstChild().toElement().tagName(), QString("Creator"));

	QString path("readonly.xml");
#ifndef WIN32
	QFile::Permissions perms = QFile::permissions(path);
	QFile::setPermissions(path, 0);
    doc = QLCFile::readXML(path);
    QVERIFY(doc.isNull() == true);
	QFile::setPermissions(path, perms);
#endif

    doc = QLCFile::readXML(path);
    QVERIFY(doc.isNull() == false);
    QCOMPARE(doc.firstChild().toElement().tagName(), QString("Workspace"));
    QCOMPARE(doc.firstChild().firstChild().toElement().tagName(), QString("Creator"));
}
开发者ID:OnceBe,项目名称:qlcplus,代码行数:29,代码来源:qlcfile_test.cpp

示例2: reactOnUpdaterOutput

void UpdateInfoPlugin::reactOnUpdaterOutput()
{
    QDomDocument updatesDomDocument = d->checkUpdateInfoWatcher->result();

    if (updatesDomDocument.isNull() ||
        !updatesDomDocument.firstChildElement().hasChildNodes())
    { // no updates are available
        startCheckTimer(60 * OneMinute);
    } else {
        //added the current almost finished task to the progressmanager
        d->updateInfoProgress = Core::ICore::instance()->progressManager()->addTask(
                d->lastCheckUpdateInfoTask, tr("Update"), QLatin1String("Update.GetInfo"), Core::ProgressManager::KeepOnFinish);

        d->updateInfoProgress->setKeepOnFinish(Core::FutureProgress::KeepOnFinish);

        d->progressUpdateInfoButton = new UpdateInfoButton();
        //the old widget is deleted inside this function
        //and the current widget becomes a child of updateInfoProgress
        d->updateInfoProgress->setWidget(d->progressUpdateInfoButton);

        //d->progressUpdateInfoButton->setText(tr("Update")); //we have this information over the progressbar
        connect(d->progressUpdateInfoButton, SIGNAL(released()),
                this, SLOT(startUpdaterUiApplication()));
    }
}
开发者ID:anchowee,项目名称:QtCreator,代码行数:25,代码来源:updateinfoplugin.cpp

示例3: saveToXml

void eGuiOpPage::saveToXml(QDomElement &node) const
{
    QDomDocument xml = node.ownerDocument();
    eASSERT(!xml.isNull());

    QDomElement pageEl = xml.createElement("page");
    pageEl.setAttribute("id", m_opPage->getId());
    pageEl.setAttribute("name", QString(m_opPage->getUserName()));
    node.appendChild(pageEl);

    for (eInt i=0; i<items().size(); i++)
    {
        QGraphicsItem *item = items().at(i);
        eASSERT(item != eNULL);

        if (item->type() == QGraphicsTextItem::Type)
        {
            // Save comment item.
            QDomElement cmtEl = xml.createElement("comment");
            cmtEl.setAttribute("xpos", item->pos().x());
            cmtEl.setAttribute("ypos", item->pos().y());
            cmtEl.setAttribute("text", ((QGraphicsTextItem *)item)->toPlainText());
            pageEl.appendChild(cmtEl);
        }
        else
        {
            // Save GUI operator.
            ((eGuiOperator *)item)->saveToXml(pageEl);
        }
    }
}
开发者ID:DX94,项目名称:Enigma-Studio-3,代码行数:31,代码来源:guioppage.cpp

示例4: isNull

bool QDomDocumentProto::isNull() const
{
    QDomDocument *item = qscriptvalue_cast<QDomDocument*>(thisObject());
    if (item)
        return item->isNull();
    return false;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例5: savePartialProjectSession

void ValgrindPart::savePartialProjectSession( QDomElement* el )
{
  QDomDocument domDoc = el->ownerDocument();
  if ( domDoc.isNull() )
    return;

  QDomElement execElem = domDoc.createElement( "executable" );
  execElem.setAttribute( "path", _lastExec );
  execElem.setAttribute( "params", _lastParams );

  QDomElement valElem = domDoc.createElement( "valgrind" );
  valElem.setAttribute( "path", _lastValExec );
  valElem.setAttribute( "params", _lastValParams );

  QDomElement ctElem = domDoc.createElement( "calltree" );
  ctElem.setAttribute( "path", _lastCtExec );
  ctElem.setAttribute( "params", _lastCtParams );

  QDomElement kcElem = domDoc.createElement( "kcachegrind" );
  kcElem.setAttribute( "path", _lastKcExec );

  el->appendChild( execElem );
  el->appendChild( valElem );
  el->appendChild( ctElem );
  el->appendChild( kcElem );
}
开发者ID:serghei,项目名称:kde3-kdevelop,代码行数:26,代码来源:valgrind_part.cpp

示例6: loadXML

QFile::FileError QLCFixtureDef::loadXML(const QString& fileName)
{
    QFile::FileError error = QFile::NoError;

    if (fileName.isEmpty() == true)
        return QFile::OpenError;

    QDomDocument doc = QLCFile::readXML(fileName);
    if (doc.isNull() == true)
    {
        qWarning() << Q_FUNC_INFO << "Unable to read from" << fileName;
        return QFile::ReadError;
    }

    if (doc.doctype().name() == KXMLQLCFixtureDefDocument)
    {
        if (loadXML(doc) == true)
            error = QFile::NoError;
        else
            error = QFile::ReadError;
    }
    else
    {
        error = QFile::ReadError;
        qWarning() << Q_FUNC_INFO << fileName
                   << "is not a fixture definition file";
    }

    return error;
}
开发者ID:cderek99,项目名称:qlcplus,代码行数:30,代码来源:qlcfixturedef.cpp

示例7: parsingBenchmarkComparison

void BenchmarkTests::parsingBenchmarkComparison()
{
    const KMime::Message::Ptr kolabItem = readMimeFile( TESTFILEDIR+QString::fromLatin1("/v2/event/complex.ics.mime") );
    KMime::Content *xmlContent = findContentByType( kolabItem, "application/x-vnd.kolab.event" );
    QVERIFY ( xmlContent );
    const QByteArray xmlData = xmlContent->decodedContent();
    //     qDebug() << xmlData;
    const QDomDocument xmlDoc = KolabV2::Event::loadDocument( QString::fromUtf8(xmlData) );
    QVERIFY ( !xmlDoc.isNull() );
    const KCalCore::Event::Ptr i = KolabV2::Event::fromXml( xmlDoc, QString::fromLatin1("Europe/Berlin") );
    QVERIFY ( i );
    const Kolab::Event &event = Kolab::Conversion::fromKCalCore(*i);
    const std::string &v3String = Kolab::writeEvent(event);
    
    QFETCH(bool, v2Parser);
    
    //     Kolab::readEvent(v3String, false); //init parser (doesn't really change the results it seems)
    //     qDebug() << QString::fromUtf8(xmlData);
    //     qDebug() << "------------------------------------------------------------------------------------";
    //     qDebug() << QString::fromStdString(v3String);
    if (v2Parser) {
        QBENCHMARK {
            KolabV2::Event::fromXml( KolabV2::Event::loadDocument( QString::fromUtf8(xmlData) ), QString::fromLatin1("Europe/Berlin") );
        }
    } else {
开发者ID:detrout,项目名称:libkolab,代码行数:25,代码来源:benchmark.cpp

示例8: api_validate_barcode

int api_validate_barcode(QString data){
	QMap <QString, QString> map;
	map["barcode"] = data;
	map["token"] = g_token;

	QDomDocument doc;
	int http = api_request(&doc, "/api/tickets/validate-barcode/", map);
	

	if(doc.isNull() || http != STATUS_HTTP_OK) return MAKELRESULT(0, http);

	QDomElement root = doc.documentElement();
	
	
	QDomElement statusText = root.firstChildElement("statusText");
	if(!statusText.isNull()){
		printf("[api_login] found statusText node\n");
		if(statusText.text().compare("OK_VALID")){
			printf("[api_validate_barcode] fail");
			return MAKELRESULT(STATUS_GENERAL_FAILURE, http);
		}
	}

	QDomElement edata = root.firstChildElement("data");
	if(!data.isNull()){
		QDomElement ticketStatusCode = edata.firstChildElement("ticketStatusCode");
		if(!ticketStatusCode.isNull()){
			std::cout << "[api_validate_barcode] http code = " << http << "\n";
			std::cout << "[api_validate_barcode] return code = " << MAKELRESULT(ticketStatusCode.text().toStdString().at(0) - '0', http) << "\n";
			return MAKELRESULT(ticketStatusCode.text().toStdString().at(0) - '0', http);
		}
	}

	return MAKELRESULT(STATUS_GENERAL_FAILURE, http);
}
开发者ID:barcodetickets,项目名称:bts-client,代码行数:35,代码来源:api.cpp

示例9: getDataDocument

/* public slots */
QDomDocument ChannelDevice::getDataDocument() const
{
    QDomDocument doc;
    CharDevice *wdg = static_cast<CharDevice*>(charDevWdg->currentWidget());
    doc = wdg->getDataDocument();
    if ( doc.isNull() ) {
        QDomElement _device, _devDesc;
        _device = doc.createElement("device");
        _devDesc = doc.createElement("channel");
        _device.appendChild(_devDesc);
        doc.appendChild(_device);
    };
    QDomElement _target = doc.createElement("target");
    _target.setAttribute("type", "virtio");
    _target.setAttribute("name", chanType->currentText());
    doc.firstChildElement("device")
            .firstChildElement("channel")
            .appendChild(_target);
    QString _type = devType->itemData(
                devType->currentIndex(),
                Qt::UserRole).toString();
    doc.firstChildElement("device")
            .firstChildElement("channel")
            .setAttribute("type", _type);
    return doc;
}
开发者ID:benklop,项目名称:qt-virt-manager,代码行数:27,代码来源:channel_device.cpp

示例10: transactionSuccess

bool QgsWFSProvider::transactionSuccess( const QDomDocument& serverResponse ) const
{
  if ( serverResponse.isNull() )
  {
    return false;
  }

  QDomElement documentElem = serverResponse.documentElement();
  if ( documentElem.isNull() )
  {
    return false;
  }

  QDomNodeList transactionResultList = documentElem.elementsByTagNameNS( QgsWFSConstants::WFS_NAMESPACE, "TransactionResult" );
  if ( transactionResultList.size() < 1 )
  {
    return false;
  }

  QDomNodeList statusList = transactionResultList.at( 0 ).toElement().elementsByTagNameNS( QgsWFSConstants::WFS_NAMESPACE, "Status" );
  if ( statusList.size() < 1 )
  {
    return false;
  }

  if ( statusList.at( 0 ).firstChildElement().localName() == "SUCCESS" )
  {
    return true;
  }
  else
  {
    return false;
  }
}
开发者ID:MrBenjaminLeb,项目名称:QGIS,代码行数:34,代码来源:qgswfsprovider.cpp

示例11: insertedFeatureIds

QStringList QgsWFSProvider::insertedFeatureIds( const QDomDocument& serverResponse ) const
{
  QStringList ids;
  if ( serverResponse.isNull() )
  {
    return ids;
  }

  QDomElement rootElem = serverResponse.documentElement();
  if ( rootElem.isNull() )
  {
    return ids;
  }

  QDomNodeList insertResultList = rootElem.elementsByTagNameNS( QgsWFSConstants::WFS_NAMESPACE, "InsertResult" );
  for ( int i = 0; i < insertResultList.size(); ++i )
  {
    QDomNodeList featureIdList = insertResultList.at( i ).toElement().elementsByTagNameNS( QgsWFSConstants::OGC_NAMESPACE, "FeatureId" );
    for ( int j = 0; j < featureIdList.size(); ++j )
    {
      QString fidString = featureIdList.at( j ).toElement().attribute( "fid" );
      if ( !fidString.isEmpty() )
      {
        ids << fidString;
      }
    }
  }
  return ids;
}
开发者ID:MrBenjaminLeb,项目名称:QGIS,代码行数:29,代码来源:qgswfsprovider.cpp

示例12: parseXMl

void GLDMaskWidget::parseXMl(const GString& filename)
{
    if(nullptr == filename)
    {
        return;
    }

    QFile file(filename);
    if(!file.open(QFile::ReadOnly | QFile::Text))
    {
        return;
    }

    QString strError;
    QDomDocument document;
    int errLin = 0, errCol = 0;

    if(!document.setContent(&file, false, &strError, &errLin, &errCol))
    {
        return;
    }

    if(document.isNull())
    {
        return;
    }

    QDomElement root = document.documentElement();
    GString elementTagName = root.firstChildElement().tagName();
    QDomNodeList nodeList = root.elementsByTagName(elementTagName);

    for (int i = 0; i < nodeList.size(); ++i)
    {
        GLDGuideInfo guideInfo;

        QDomElement element = nodeList.item(i).firstChildElement();

        while (!element.isNull())
        {
            GLDGuideInfoItem guideInfoItem = parseNodeItem(element);

            if (element.tagName() == "mask")
            {
                guideInfo.m_maskWidgetItem = guideInfoItem;
            }
            else if (element.tagName() == "close")
            {
                guideInfo.m_closeButtonItem = guideInfoItem;
            }
            else if (element.tagName() == "next")
            {
                guideInfo.m_nextButtonItem = guideInfoItem;
            }

            element = element.nextSiblingElement();
        }

        doRegisterGuideInfo(guideInfo);
    }
}
开发者ID:Iownnoname,项目名称:qt,代码行数:60,代码来源:gldmaskwidget.cpp

示例13: parseStructureNames

QStringList OsdParser::parseStructureNames() const
{
    QStringList ret;
    QScopedPointer<ScriptLogger> rootLogger(new ScriptLogger); //only needed if we get an error right now
    rootLogger->setLogToStdOut(true); //we cannot get our messages into the script console, so do this instead
    QDomDocument document = openDoc(rootLogger.data());
    if (document.isNull())
        return QStringList();
    QDomElement rootElem = document.firstChildElement(QStringLiteral("data"));
    if (rootElem.isNull())
        return QStringList();
    for (QDomElement childElement = rootElem.firstChildElement();
            !childElement.isNull(); childElement = childElement.nextSiblingElement())
    {
        QString tag = childElement.tagName();
        if (tag == TYPE_STRUCT || tag == TYPE_ARRAY || tag == TYPE_BITFIELD || tag == TYPE_PRIMITIVE
                || tag == TYPE_UNION || tag == TYPE_ENUM || tag == TYPE_FLAGS || tag == TYPE_STRING)
        {
            //TODO allow e.g. <uint8 name="asfd">
            ret.append(readProperty(childElement, PROPERTY_NAME, i18n("<invalid name>")));
        }
        else
        {
            rootLogger->error(QString()).nospace() << "Unknown tag name in plugin " << mPluginName << " :"
                    << tag;
        }
    }
    return ret;
}
开发者ID:KDE,项目名称:okteta,代码行数:29,代码来源:osdparser.cpp

示例14: writeToXml

//==============================================================
//  Запись в XML
//==============================================================
void SettingAnimation::writeToXml(QDomDocument doc, QDomElement &root)
{
    Q_ASSERT(!doc.isNull());
    Q_ASSERT(!root.isNull());

    writeFpsToXml(doc, root);
    writeFrameCountToXml(doc, root);
    writeLoopToXml(doc, root);
}
开发者ID:pimenov-and,项目名称:Games,代码行数:12,代码来源:settinganimation.cpp

示例15: sendTransactionDocument

bool QgsWFSProvider::sendTransactionDocument( const QDomDocument& doc, QDomDocument& serverResponse )
{
  if ( doc.isNull() )
  {
    return false;
  }

  QgsWFSTransactionRequest request( mShared->mURI.uri() );
  return request.send( doc, serverResponse );
}
开发者ID:MrBenjaminLeb,项目名称:QGIS,代码行数:10,代码来源:qgswfsprovider.cpp


注:本文中的QDomDocument::isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。