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


C++ QDomDocument函数代码示例

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


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


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