• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ QDomDocument函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中QDomDocument函数的典型用法代码示例。如果您正苦于以下问题:C++ QDomDocument函数的具体用法?C++ QDomDocument怎么用?C++ QDomDocument使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: QWidget

ExerciseWindow::ExerciseWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ExerciseWindow)
{
    ui->setupUi(this);
    ui->scrollArea->setWidgetResizable(false);
    QPalette Pal(palette());
    Pal.setColor(QPalette::Background, Qt::white);
    ui->scrollArea->setAutoFillBackground(true);
    ui->scrollArea->setPalette(Pal);
    openFromNewLine = ui->checkBox_newLine->isChecked();
    srand((unsigned)time (0));
    makeFlowChart();
    QString name = windowTitle();
    doc = QDomDocument("flowchart");
    generateVars();
    QDomElement domElement = doc.createElement(name);
    generateXML(domElement, doc);
    doc.appendChild(domElement);
    ui->textBrowser->setFont(QFont("Courier", 10));
    ui->textBrowser_2->setFont(QFont("Courier", 10));
    connect(ui->pushButton, SIGNAL(clicked()), SLOT(checkExercise()));
    connect(ui->checkBox_newLine, SIGNAL(clicked()), SLOT(checkExercise()));
    connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), SLOT(changeFontSize(int)));
    connect(ui->checkBox, SIGNAL(toggled(bool)), wdg, SLOT(HideTexts(bool)));
}
开发者ID:MrBentCode,项目名称:FlowChart_trainer,代码行数:26,代码来源:exercisewindow.cpp


示例2: QDomDocument

QDomDocument SecurityLabel::readData()
{
    QDomText data;
    QDomDocument doc = QDomDocument();
    if ( !useSecLabel->isChecked() ) return doc;
    QDomElement _secLabel, _label;
    QString _t, _r, _m;
    _secLabel= doc.createElement("seclabel");

    _t = type->currentText().toLower();
    if ( _t!="none" ) {
        _m = model->currentText().toLower();
         _secLabel.setAttribute("model", model->currentText().toLower());
        _r = relabel->currentText().toLower();
        if ( _r!="default" ) {
            _secLabel.setAttribute("relabel", _r);
        };
        _label =doc.createElement(labelTypeLabel->currentText().toLower());
        data = doc.createTextNode(label->text());
        _label.appendChild(data);
        _secLabel.appendChild(_label);
    };
    _secLabel.setAttribute("type", _t);
    doc.appendChild(_secLabel);
    return doc;
}
开发者ID:benklop,项目名称:qt-virt-manager,代码行数:26,代码来源:security_label.cpp


示例3: QString

bool AvolitesD4Parser::loadXML(const QString& path)
{
    m_lastError = QString();
    m_documentRoot = QDomDocument();
    m_channels.clear();

    if (path.isEmpty())
    {
        m_lastError = "filename not specified";
        return false;
    }

    m_documentRoot = QLCFile::readXML(path);
    if (m_documentRoot.isNull() == true)
    {
        m_lastError = "unable to read document";
        return false;
    }

    // check if the document has <Fixture></Fixture> if not then it's not a valid file
    QDomElement el = m_documentRoot.namedItem(KD4TagFixture).toElement();
    if (el.isNull() && (!el.hasAttribute(KD4TagName) ||
        !el.hasAttribute(KD4TagShortName) || !el.hasAttribute(KD4TagCompany)))
    {
        m_lastError = "wrong document format";
        return false;
    }

    return true;
}
开发者ID:OnceBe,项目名称:qlcplus,代码行数:30,代码来源:avolitesd4parser.cpp


示例4: QDomDocument

bool MyMoneyTemplate::exportTemplate(void(*callback)(int, int, const QString&))
{
  m_progressCallback = callback;

  m_doc = QDomDocument("KMYMONEY-TEMPLATE");

  QDomProcessingInstruction instruct = m_doc.createProcessingInstruction(QString("xml"), QString("version=\"1.0\" encoding=\"utf-8\""));
  m_doc.appendChild(instruct);

  QDomElement mainElement = m_doc.createElement("kmymoney-account-template");
  m_doc.appendChild(mainElement);

  QDomElement title = m_doc.createElement("title");
  mainElement.appendChild(title);

  QDomElement shortDesc = m_doc.createElement("shortdesc");
  mainElement.appendChild(shortDesc);

  QDomElement longDesc = m_doc.createElement("longdesc");
  mainElement.appendChild(longDesc);

  QDomElement accounts = m_doc.createElement("accounts");
  mainElement.appendChild(accounts);

  // addAccountStructure(accounts, MyMoneyFile::instance()->asset());
  // addAccountStructure(accounts, MyMoneyFile::instance()->liability());
  addAccountStructure(accounts, MyMoneyFile::instance()->income());
  addAccountStructure(accounts, MyMoneyFile::instance()->expense());
  // addAccountStructure(accounts, MyMoneyFile::instance()->equity());

  return true;
}
开发者ID:CGenie,项目名称:kmymoney,代码行数:32,代码来源:mymoneytemplate.cpp


示例5: qWarning

QDomDocument QLCFile::readXML(const QString& path)
{
    if (path.isEmpty() == true)
    {
        qWarning() << Q_FUNC_INFO
                   << "Empty path given. Not attempting to load file.";
        return QDomDocument();
    }

    QDomDocument doc;
    QFile file(path);
    if (file.open(QIODevice::ReadOnly) == true)
    {
        QString msg;
        int line = 0;
        int col = 0;
        if (doc.setContent(&file, false, &msg, &line, &col) == false)
        {
            qWarning() << Q_FUNC_INFO << "Error loading file" << path
                       << ":" << msg << ", line:" << line << ", col:" << col;
        }
    }
    else
    {
        qWarning() << Q_FUNC_INFO << "Unable to open file:" << path;
    }

    file.close();

    return doc;
}
开发者ID:dadoonet,项目名称:qlcplus,代码行数:31,代码来源:qlcfile.cpp


示例6: QMainWindow

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
//	listWidget(new QListWidget),
//	ui(new Ui::MainWindow),
//	nRow(0)
	model(0)
{
//	QHBoxLayout *layout = new QHBoxLayout();
//	layout->addWidget(listWidget);

//	setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px ; color:rgb(255,255,255)}");
//	setCentralWidget(listWidget);

//	ui->setupUi(this);
	fileMenu = menuBar()->addMenu(tr("&File"));
	fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()), QKeySequence::Open);
	fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence::Quit);

	model = new DomModel(QDomDocument(), this);
	view = new QTreeView(this);
	view->setModel(model);

	setCentralWidget(view);
	setWindowTitle(tr("Simple DOM Model"));
}
开发者ID:ottodevs,项目名称:CoPilot,代码行数:25,代码来源:mainwindow.cpp


示例7: auth

bool TestDspCmdDirGetVmList::getExpectedVmList(QList<QDomDocument>& expectedList)
{
   QString  errorMsg;
   int      errorLine, errorColumn;

   expectedList.clear();

   CAuthHelper auth(TestConfig::getUserLogin());
   if (!auth.AuthUser(TestConfig::getUserPassword()))
   {
      WRITE_TRACE(DBG_FATAL, "can't auth user[%s] on localhost ", TestConfig::getUserLogin());
      return false;
   }

	// __asm int 3;
   SmartPtr<CVmDirectory> pVmDir = GetUserVmDirectory();
   if( !pVmDir )
   {
      WRITE_TRACE(DBG_FATAL, "can't get vm directory from ");
      return false;
   }

   for (int idx=0; idx< pVmDir->m_lstVmDirectoryItems.size(); idx++)
   {
      CVmDirectoryItem* pDirItem= pVmDir->m_lstVmDirectoryItems[idx];
      QString strVmHome=pDirItem->getVmHome();
      QString strChangedBy=pDirItem->getChangedBy();
      QString strChangeDateTime=pDirItem->getChangeDateTime().toString(XML_DATETIME_FORMAT);

      //FIXME: add checking access permission to vm.xml
      // fixed: when i started as test-user it doing automatically

      if (!CFileHelper::FileCanRead(strVmHome, &auth))
         continue;

      QFile vmConfig(strVmHome);
      if(!vmConfig.open(QIODevice::ReadOnly))
      {
         WRITE_TRACE(DBG_FATAL, "can't open file [%s]", strVmHome.toUtf8().data());
         break;
      }

      expectedList.push_back(QDomDocument());
      QDomDocument& doc=expectedList[expectedList.size()-1];
      if(!doc.setContent(&vmConfig, false, &errorMsg, &errorLine, &errorColumn ))
      {
         WRITE_TRACE(DBG_FATAL, "error of parsing file: [fname=%s], errorMsg=%s, line=%d, column=%d"
            , strVmHome.toUtf8().data()
            , errorMsg.toUtf8().data(), errorLine, errorColumn);
         expectedList.clear();
         return false;
      }

      addNodeToIdentityPart(doc, XML_VM_DIR_ND_VM_HOME, strVmHome);
      addNodeToIdentityPart(doc, XML_VM_DIR_ND_CHANGED_BY, strChangedBy);
      addNodeToIdentityPart(doc, XML_VM_DIR_ND_CHANGED_DATETIME, strChangeDateTime);
   }//for
   return (true);
}
开发者ID:OpenVZ,项目名称:prl-disp-service,代码行数:59,代码来源:TestDspCmdDirGetVmList.cpp


示例8: virConnectListAllNodeDevices

/* private slots */
void USB_Host_Device::setAvailabledUSBDevices()
{
    int i = 0;
    QStringList      devices;
    virNodeDevice  **nodeDevices = NULL;
    if ( currWorkConnect!=NULL ) {
        unsigned int flags =
                VIR_CONNECT_LIST_NODE_DEVICES_CAP_USB_DEV;
        int ret = virConnectListAllNodeDevices(currWorkConnect, &nodeDevices, flags);
        if ( ret<0 ) {
            sendConnErrors();
        } else {
            while ( nodeDevices[i] != NULL ) {
                devices.append( QString("%1\n")
                                // flags: extra flags; not used yet,
                                // so callers should always pass 0
                                .arg(virNodeDeviceGetXMLDesc(nodeDevices[i], 0)));
                virNodeDeviceFree(nodeDevices[i]);
                i++;
            };
        };
        free(nodeDevices);
    };
    //int devs = virNodeNumOfDevices(currWorkConnect, NULL, 0);
    //qDebug()<<"Devices("<<devs<<i<<"):\n"<<devices.join("\n");
    // set unique device description to devList
    foreach (QString _dev, devices) {
        //qDebug()<<_dev;
        QString devName, devIdentity;
        QDomElement capability, product, vendor;
        QDomDocument doc = QDomDocument();
        doc.setContent(_dev);
        // filter out **** Host Controllers
        if ( !doc.
             firstChildElement("device").
             firstChildElement("parent").
             firstChild().toText().data().
             startsWith("usb") ) continue;
        //
        capability = doc.firstChildElement("device").
                firstChildElement("capability");
        product = capability.firstChildElement("product");
        vendor = capability.firstChildElement("vendor");
        // devIdentity format: <vendor:product>
        devIdentity.append(vendor.attribute("id"));
        devIdentity.append(":");
        devIdentity.append(product.attribute("id"));
        // devName format: <vendor_product>
        devName.append(vendor.firstChild().toText().data());
        devName.append("\n");
        devName.append(product.firstChild().toText().data());
        if ( devList->findItems(devName,
                                Qt::MatchExactly |
                                Qt::MatchCaseSensitive)
             .isEmpty() ) {
            devList->insertItem(0, devName);
            devList->item(0)->setData(Qt::UserRole, devIdentity);
        };
    };
开发者ID:benklop,项目名称:qt-virt-manager,代码行数:60,代码来源:usb_host_device.cpp


示例9: QDomDocument

void ClipBoard::reset()
{
    actionCopy->setEnabled(false);
    actionCut->setEnabled(false);
    actionPaste->setEnabled(false);

    document = QDomDocument();
}
开发者ID:hftom,项目名称:MachinTruc,代码行数:8,代码来源:clipboard.cpp


示例10: QDomDocument

const QDomDocument ServiceModel::domDocument(const QModelIndex& currentIndex) const
{
    ServiceHelper *serviceHelper;
    serviceHelper = this->serviceHelper(currentIndex);
    if (!serviceHelper)
        return QDomDocument();
    return serviceHelper->domDocument();
}
开发者ID:Anuriel,项目名称:my-libaccounts-ui,代码行数:8,代码来源:service-model.cpp


示例11: QDomDocument

QString KoProperties::store(const QString &s) const
{
    QDomDocument doc = QDomDocument(s);
    QDomElement root = doc.createElement(s);
    doc.appendChild(root);

    save(root);
    return doc.toString();
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:9,代码来源:KoProperties.cpp


示例12: Q_ASSERT

void GameControllerAttachment::createNodeAttachment()
{	
	Q_ASSERT(m_currentNode != 0);	
	QDomElement node = m_currentNode->xmlNode().insertBefore(QDomDocument().createElement("Attachment"), QDomNode()).toElement();
	node.setAttribute("type", plugInName());
	node.setAttribute("name", m_currentNode->property("Name").toString() + "_" + m_currentNode->property("ID").toString());
	initNodeAttachment(m_currentNode);
	setCurrentNode(m_currentNode);
}
开发者ID:algts,项目名称:Horde3D,代码行数:9,代码来源:GameControllerAttachment.cpp


示例13: genXML

void genXML(QString fileName, QSqlQuery query)
{
    QDomDocument doc;
    QDomElement root;

    doc = QDomDocument("GOBLETXML");

    root = doc.createElement("SQLResultXML");
    root.setAttribute("version", "1.0");
    doc.appendChild(root);

    QDomElement varName;
    QDomText varValue;

    QDomElement querycols;
    querycols = doc.createElement("ResultColumns");
    root.appendChild(querycols);
    int pos;
    for (pos = 0; pos <= query.record().count()-1;pos++)
    {
        varName = doc.createElement("Column");
        querycols.appendChild(varName);
        varValue = doc.createTextNode(query.record().field(pos).name());
        varName.appendChild(varValue);
    }


    QDomElement querydata;
    querydata = doc.createElement("ResultData");
    root.appendChild(querydata);

    while (query.next())
    {
        QDomElement queryRow;
        queryRow = doc.createElement("Row");
        querydata.appendChild(queryRow);
        for (pos = 0; pos <= query.record().count()-1;pos++)
        {
            varName = doc.createElement("Column");
            varName.setAttribute("name",query.record().field(pos).name());
            queryRow.appendChild(varName);
            varValue = doc.createTextNode(query.value(getFieldIndex(query,query.record().field(pos).name())).toString());
            varName.appendChild(varValue);
        }
    }

    QFile file(fileName);
    if (file.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        QTextStream out(&file);
        out.setCodec("UTF-8");
        doc.save(out,1,QDomNode::EncodingFromTextStream);
        file.close();
    }

}
开发者ID:qlands,项目名称:GOBLET,代码行数:56,代码来源:main.cpp


示例14: file

QDomDocument LocalFileMng::openXmlDocument( const QString& filename )
{
	bool TinyXMLCompat = LocalFileMng::checkTinyXMLCompatMode( filename );

	QDomDocument doc;
	QFile file( filename );

	if ( !file.open(QIODevice::ReadOnly) )
		return QDomDocument();

	if( TinyXMLCompat ) {
	    QString enc = QTextCodec::codecForLocale()->name();
	    if( enc == QString("System") ) {
		    enc = "UTF-8";
	    }
	    QByteArray line;
	    QByteArray buf = QString("<?xml version='1.0' encoding='%1' ?>\n")
		.arg( enc )
		.toLocal8Bit();

	    //_INFOLOG( QString("Using '%1' encoding for TinyXML file").arg(enc) );

	    while( !file.atEnd() ) {
			line = file.readLine();
			LocalFileMng::convertFromTinyXMLString( &line );
			buf += line;
	    }

	    if( ! doc.setContent( buf ) ) {
			file.close();
			return QDomDocument();
	    }

	} else {
	    if( ! doc.setContent( &file ) ) {
			file.close();
			return QDomDocument();
	    }
	}
	file.close();
	
	return doc;
}
开发者ID:AHudon,项目名称:SOEN6471_LMMS,代码行数:43,代码来源:local_file_mgr.cpp


示例15: QDomDocument

void odkFormReader::processXML(QString inputFile, QString mainTable)
{
    tables.clear();
    treeItems.clear();

    doc = QDomDocument("ODKDocument");
    QFile xmlfile(inputFile);
    if (!xmlfile.open(QIODevice::ReadOnly))
        return;
    if (!doc.setContent(&xmlfile))
    {
        xmlfile.close();
        return;
    }
    xmlfile.close();

    QDomNodeList list;
    QDomElement item;
    QDomNode node;

    QDomElement mainInstance;

    list = doc.elementsByTagName("instance");
    if (list.count() > 0)
    {
        int pos;
        for (pos = 0; pos <= list.count()-1;pos++)
        {
            item = list.item(pos).toElement();
            if (item.attribute("id","NONE") == "NONE")
            {
                mainInstance = item;
                break;
            }
        }
    }
    item = mainInstance.firstChild().toElement();


    surveyID =item.tagName();


    list = doc.elementsByTagName("h:body");
    if (list.count() > 0)
    {
        node = list.item(0).firstChild();
        TtableDef nulltable;
        nulltable.name = "NULL";
        extractFields(node,mainTable,nulltable,"main",surveyID);
    }

    //Now that we have the list of tables we move the list into a tree


}
开发者ID:ilri,项目名称:odkviewer,代码行数:55,代码来源:odkformreader.cpp


示例16: Q_D

QDomDocument AccountProviderModel::domDocument(const QModelIndex& currentIndex)
{
    Q_D(AccountProviderModel);
    ProviderHelper *providerHelper;

    providerHelper = d->providerList.at(currentIndex.row());
    if (!providerHelper)
        return QDomDocument();

    return providerHelper->domDocument();
}
开发者ID:smita30apr,项目名称:qmlaccounts-ui,代码行数:11,代码来源:account-provider-model.cpp


示例17: QDomDocument

void PlaylistHandler::checkInit() {
    if (used)
        return;
    used = true;
    doc = QDomDocument("GSPlayerPL");
    if (!QFile::exists(QApplication::applicationDirPath() + QDir::separator() + "Playlists.xml")) {
        init();
    } else {
        load();
    }
}
开发者ID:xxmicloxx,项目名称:GSPlayerQT,代码行数:11,代码来源:playlisthandler.cpp


示例18: vk_assert

/* Called by xml reader at start of parsing */
bool VgLogHandler::startDocument()
{
   //   vkPrintErr("VgLogHandler::startDocument()\n");
   vk_assert( logview != 0 );
   
   doc = QDomDocument();
   node = doc;
   m_fatalMsg = QString();
   m_finished = false;
   m_started = true;
   return true;
}
开发者ID:Grindland,项目名称:valkyrie,代码行数:13,代码来源:vglogreader.cpp


示例19: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QDomDocument (doc);
    QFile file("my.xml");
    if(!file.open(QIODevice::ReadOnly))
    {
        return 0;
    }

    QString errorStr;
    int errorLine;
    int errorColumnn;

    if(!doc.setContent(&file,false,&errorStr,&errorLine,&errorColumnn))
    {
        qDebug() << "file closed";
        std::cerr << "Error: Parse error at line" << errorLine <<","
                  << "cloumn" << errorColumnn << ":"
                  << qPrintable(errorStr) << std::endl;
        file.close();
        return 0;
    }
    file.close();

    QDomNode firstNote = doc.firstChild();
    qDebug() << qPrintable(firstNote.nodeName())
                <<qPrintable(firstNote.nodeValue());

    QDomElement docElem = doc.documentElement();
    QDomNode n = docElem.firstChild();
    while(!n.isNull())
    {
        if(n.isElement())
        {
            QDomElement e = n.toElement();
            qDebug() << qPrintable(e.tagName())
                     << qPrintable(e.attribute("id"));

            QDomNodeList list = e.childNodes();
            for(int i=0; i<list.count();i++)
            {
                QDomNode node = list.at(i);
                if(node.isElement())
                    qDebug() << " " << qPrintable(node.toElement().tagName())
                             << qPrintable(node.toElement().text());

            }
        }
        n = n.nextSibling();
    }
    return a.exec();
}
开发者ID:vcheung,项目名称:QtPro,代码行数:53,代码来源:main.cpp


示例20: qPrintable

void Browser::save(void)
{
  std::cout << qPrintable(tr("Saving data")) << std::endl;

  QFile file( CFG_FILE );
  QDir::setCurrent( CFG_DIR );

  if( !file.open( QIODevice::WriteOnly ) )
    {
      QString strErr = QObject::tr("Error: Can't save config file !");
      std::cerr << " " << qPrintable(strErr) << std::endl;
      QMessageBox::warning(0,
                           QObject::tr("Saving config file"),
                           strErr
                          );
      file.close();
      return;
    }

  std::cout << qPrintable(tr(" ")) << qPrintable(tr("Saving...")) << std::endl;

  QDomImplementation impl = QDomDocument().implementation();

  QString name_ml = QLatin1String("BrowserML");
  QString publicId = QLatin1String("-//CELLES//DTD Browser 0.1 //EN");
  QString systemId = QLatin1String("http://www.celles.net/dtd/browser/browser_data-0_1.dtd");
  QDomDocument doc(impl.createDocumentType(name_ml,publicId,systemId));
  // add some XML comment at the beginning
  doc.appendChild(doc.createComment(QLatin1String("This file describe data for a very light browser for dynamic display")));
  doc.appendChild(doc.createTextNode(QLatin1String("\n"))); // for nicer output
  doc.appendChild(doc.createComment(QLatin1String("http://www.celles.net/wiki/Browser")));
  doc.appendChild(doc.createTextNode(QLatin1String("\n"))); // for nicer output

  QDomElement root = doc.createElement(QLatin1String("browser")); // racine
  root.setAttribute( QLatin1String("timer"), timer->interval() );
  //std::cout << "timer=" << timer->interval() << std::endl;

  doc.appendChild(root);

  for (int i=0 ; i<url_list.count() ; i++) {
    QDomElement dom_elt = doc.createElement( QLatin1String("url") );
    QDomText dom_txt = doc.createTextNode(url_list[i].toString());
    dom_elt.appendChild(dom_txt);
    root.appendChild( dom_elt );
  }

  QTextStream ts( &file );
  ts << doc.toString();

  file.close();

  std::cout << qPrintable(tr(" ")) << qPrintable(tr("Data saved")) << std::endl;
}
开发者ID:BackupTheBerlios,项目名称:openphysic-svn,代码行数:53,代码来源:browser.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ QDomElement函数代码示例发布时间:2022-05-30
下一篇:
C++ QDir函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap