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


C++ QDomNode::hasAttributes方法代码示例

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


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

示例1: createFromXml

RedisConnectionConfig RedisConnectionConfig::createFromXml(QDomNode & connectionNode) 
{
    RedisConnectionConfig connectionConfig;

    if (!connectionNode.hasAttributes()) {
        return connectionConfig;
    }

    QDomNamedNodeMap attr = connectionNode.attributes();

    getValueFromXml(attr, "name", connectionConfig.name);
    getValueFromXml(attr, "host", connectionConfig.host);
    getValueFromXml(attr, "port", connectionConfig.port);    
    getValueFromXml(attr, "auth", connectionConfig.auth);        

    getValueFromXml(attr, "sshHost", connectionConfig.sshHost);    
    getValueFromXml(attr, "sshUser", connectionConfig.sshUser);    
    getValueFromXml(attr, "sshPassword", connectionConfig.sshPassword);
    getValueFromXml(attr, "sshPort", connectionConfig.sshPort);

    getValueFromXml(attr, "sshPublicKey", connectionConfig.sshPublicKey);
    getValueFromXml(attr, "sshPrivateKey", connectionConfig.sshPrivateKey);

    getValueFromXml(attr, "namespaceSeparator", connectionConfig.namespaceSeparator);   
    getValueFromXml(attr, "connectionTimeout", connectionConfig.connectionTimeout);   
    getValueFromXml(attr, "executeTimeout", connectionConfig.executeTimeout);   

    return connectionConfig;
}
开发者ID:KingLee2015,项目名称:RedisDesktopManager,代码行数:29,代码来源:RedisConnectionConfig.cpp

示例2: hasAttributes

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

示例3: argumentType

QString ServiceDefinition::argumentType(const QString &serviceName,
                                        const QString &argument) const {
  QDomNode node = d->mInputArguments[serviceName][argument];

  if (node.hasAttributes()) {
    QDomAttr attr = d->getAttributeFromNode(node, "type");
    return attr.nodeValue();
  }

  return "";
}
开发者ID:shaheeqa,项目名称:plexydesk,代码行数:11,代码来源:servicedefinition.cpp

示例4: Init

bool EpochModel::Init(QDomNode &node)
{
 if(!node.hasAttributes()) return false;
 QDomNamedNodeMap attr= node.attributes();
 QString indexString = (attr.namedItem("index")).nodeValue() ;
 qDebug("reading Model with index %i ",indexString.toInt());
        for(QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling())
              {
                if(n.nodeName() == QString("camera"))  cameraName = n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("texture")) textureName= n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("depth"))   depthName  = n.attributes().namedItem("filename").nodeValue();
                if(n.nodeName() == QString("count"))   countName  = n.attributes().namedItem("filename").nodeValue();
            }

  QString tmpName=textureName.left(textureName.length()-4);
  maskName = tmpName.append(".mask.png");
  return true;
}
开发者ID:Jerdak,项目名称:meshlab,代码行数:18,代码来源:epoch_io.cpp

示例5: getFactoryDirection

QString getFactoryDirection(int direction)
{
  QString direct;
  QDomDocument doc("factDirDoc");
  QFile *file = new QFile("languagedata.xml");
  QString fId;
  fId.sprintf("IDS_FACTORY_NAME_DIR_%d", direction);

  if (!file->open(QIODevice::ReadOnly))
    return " ";
  if (!doc.setContent(file))
  {
    file->close();
    return " ";
  }

  QDomNodeList list = doc.elementsByTagName("tu");
  for(int i = 0; i < list.count(); i++)
  {
    QDomNode tu = list.at(i);
    if(tu.hasAttributes() && tu.hasChildNodes())
    {
      QString attrib = tu.attributes().namedItem("tuid").nodeValue();
      if(attrib == fId)
      {
        qDebug() << "Bingo";
        QDomNodeList child = tu.childNodes();
        direct = child.at(2).toElement().text();
        file->close();
        return direct;
      }
    }
  }
  file->close();
  return direct;
}
开发者ID:devnir,项目名称:ResCalc,代码行数:36,代码来源:getxmldata.cpp

示例6: getFactoryName

QString getFactoryName(int factoryId, int cityId, int factoryDirection)
{
  QDomDocument doc("mydocument");
  QFile *file = new QFile("languagedata.xml");
  QString factoryName = "-----";
  QString fId;
  fId.sprintf("IDS_FACT_%03d", factoryId);

  if (!file->open(QIODevice::ReadOnly))
    return " ";
  if (!doc.setContent(file))
  {
    file->close();
    return " ";
  }

  QDomNodeList list = doc.elementsByTagName("tu");
  for(int i = 0; i < list.count(); i++)
  {
    QDomNode tu = list.at(i);
    if(tu.hasAttributes() && tu.hasChildNodes())
    {
      QString attrib = tu.attributes().namedItem("tuid").nodeValue();
      if(attrib == fId)
      {
        QDomNodeList child = tu.childNodes();
        factoryName = child.at(2).toElement().text();
        file->close();
        factoryName = factoryName + " " + getCityName(cityId) + " " + getFactoryDirection(factoryDirection);
        return factoryName;
      }
    }
  }
  file->close();
  return factoryName;
}
开发者ID:devnir,项目名称:ResCalc,代码行数:36,代码来源:getxmldata.cpp

示例7: qDebug

bool Arc3DModel::Init(QDomNode &node)
{
    if(!node.hasAttributes()) return false;
    QDomNamedNodeMap attr= node.attributes();
    QString indexString = (attr.namedItem("index")).nodeValue() ;
    qDebug("reading Model with index %i ",indexString.toInt());
    for(QDomNode n = node.firstChild(); !n.isNull(); n = n.nextSibling())
    {
        if(n.nodeName() == QString("camera"))  cameraName = n.attributes().namedItem("filename").nodeValue();
        if(n.nodeName() == QString("texture")) textureName= n.attributes().namedItem("filename").nodeValue();
        if(n.nodeName() == QString("depth"))   depthName  = n.attributes().namedItem("filename").nodeValue();
        if(n.nodeName() == QString("count"))   countName  = n.attributes().namedItem("filename").nodeValue();

        // import leuven camera
        {
            double cam[9];
            float focus,scale;

            FILE* lvcam;

            lvcam = fopen(cameraName.toUtf8().data(),"rb");

            // focus + image centers
            fscanf(lvcam,"%lf %lf %lf",&(cam[0]),&(cam[1]),&(cam[2]));
            fscanf(lvcam,"%lf %lf %lf",&(cam[3]),&(cam[4]),&(cam[5]));
            fscanf(lvcam,"%lf %lf %lf",&(cam[6]),&(cam[7]),&(cam[8]));

            shot.Intrinsics.DistorCenterPx[0] = cam[2];
            shot.Intrinsics.DistorCenterPx[1] = cam[5];
            //shot.Intrinsics.CenterPx[0] = cam[2];
            //shot.Intrinsics.CenterPx[1] = cam[5];
            focus = cam[4];
            scale = 1.0f;
            while(focus>150.0f)
            {
                focus /= 10.0f;
                scale /= 10.0f;
            }
            shot.Intrinsics.FocalMm = focus;
            shot.Intrinsics.PixelSizeMm[0] = scale;
            shot.Intrinsics.PixelSizeMm[1] = scale;

            // distortion
            fscanf(lvcam,"%lf %lf %lf",&(cam[0]),&(cam[1]),&(cam[2]));
            //shot.Intrinsics.k[0] = cam[0];
            //shot.Intrinsics.k[1] = cam[1];
            shot.Intrinsics.k[0] = 0.0;
            shot.Intrinsics.k[1] = 0.0;

            // orientation axis
            fscanf(lvcam,"%lf %lf %lf",&(cam[0]),&(cam[1]),&(cam[2]));
            fscanf(lvcam,"%lf %lf %lf",&(cam[3]),&(cam[4]),&(cam[5]));
            fscanf(lvcam,"%lf %lf %lf",&(cam[6]),&(cam[7]),&(cam[8]));

            Matrix44m myrot;

            myrot[0][0] = cam[0];		myrot[0][1] = cam[3];		myrot[0][2] = cam[6];		myrot[0][3] = 0.0f;
            myrot[1][0] = -cam[1];	myrot[1][1] = -cam[4];	myrot[1][2] = -cam[7];	myrot[1][3] = 0.0f;
            myrot[2][0] = -cam[2];	myrot[2][1] = -cam[5];	myrot[2][2] = -cam[8];	myrot[2][3] = 0.0f;
            myrot[3][0] = 0.0f;			myrot[3][1] = 0.0f;			myrot[3][2] = 0.0f;			myrot[3][3] = 1.0;


            shot.Extrinsics.SetRot(myrot);

            // camera position
            fscanf(lvcam,"%lf %lf %lf",&(cam[0]),&(cam[1]),&(cam[2]));
            shot.Extrinsics.SetTra(Point3m(cam[0], cam[1], cam[2]));
            //				shot.Extrinsics.sca = 1.0f;


            // image size
            fscanf(lvcam,"%lf %lf",&(cam[0]),&(cam[1]));
            shot.Intrinsics.ViewportPx.X() = (int)(cam[0]);
            shot.Intrinsics.ViewportPx.Y() = (int)(cam[1]);
            shot.Intrinsics.CenterPx[0] = (double)shot.Intrinsics.ViewportPx[0]/2.0;
            shot.Intrinsics.CenterPx[1] = (double)shot.Intrinsics.ViewportPx[1]/2.0;
            //shot.Intrinsics.DistorCenterPx[0]=shot.Intrinsics.CenterPx[0];
            //shot.Intrinsics.DistorCenterPx[1]=shot.Intrinsics.CenterPx[1];


            fclose(lvcam);
        }
    }

    QString tmpName=textureName.left(textureName.length()-4);
    maskName = tmpName.append(".mask.png");
    return true;
}
开发者ID:HaiJiaoXinHeng,项目名称:meshlab-1,代码行数:88,代码来源:edit_arc3D.cpp

示例8: file

bool EditArc3DPlugin::StartEdit(MeshDocument &_md, GLArea *_gla )
{
    er.modelList.clear();
    this->md=&_md;
    gla=_gla;
    ///////
    delete arc3DDialog;
    arc3DDialog=new v3dImportDialog(gla->window(),this);
    QString fileName=arc3DDialog->fileName;

    if (fileName.isEmpty()) return false;

    // this change of dir is needed for subsequent texture/material loading
    QString FileNameDir = fileName.left(fileName.lastIndexOf("/"));
    QDir::setCurrent(FileNameDir);

    QString errorMsgFormat = "Error encountered while loading file %1:\n%2";
    string stdfilename = QFile::encodeName(fileName).constData ();

    QDomDocument doc;


    QFile file(fileName);
    if (file.open(QIODevice::ReadOnly) && doc.setContent(&file))
    {
        file.close();
        QDomElement root = doc.documentElement();
        if (root.nodeName() == tr("reconstruction"))
        {
            QDomNode nhead = root.firstChildElement("head");
            for(QDomNode n = nhead.firstChildElement("meta"); !n.isNull(); n = n.nextSiblingElement("meta"))
            {
                if(!n.hasAttributes()) return false;
                QDomNamedNodeMap attr= n.attributes();
                if(attr.contains("name")) er.name = (attr.namedItem("name")).nodeValue() ;
                if(attr.contains("author")) er.author = (attr.namedItem("author")).nodeValue() ;
                if(attr.contains("created")) er.created = (attr.namedItem("created")).nodeValue() ;
            }
            for(QDomNode n = root.firstChildElement("model"); !n.isNull(); n = n.nextSiblingElement("model"))
            {
                Arc3DModel em;
                em.Init(n);
                //em.cam.TR
                er.modelList.push_back(em);

            }
        }
    }


    arc3DDialog->setArc3DReconstruction( &er);

    arc3DDialog->exportToPLY=false;


    connect(arc3DDialog, SIGNAL(closing()),gla,SLOT(endEdit()) );
    connect(arc3DDialog->ui.plyButton, SIGNAL(clicked()),this,SLOT(ExportPly()) );
    connect(arc3DDialog->ui.exportbut,SIGNAL(clicked()),this,SLOT(exportShotsToRasters()));
    connect(this,SIGNAL(resetTrackBall()),gla,SLOT(resetTrackBall()));


    return true;
}
开发者ID:HaiJiaoXinHeng,项目名称:meshlab-1,代码行数:63,代码来源:edit_arc3D.cpp

示例9: operator

    bool operator()(QDomNode node) {
	if(!node.hasChildNodes() && !node.hasAttributes() && !node.isText()) {
	    return true;
	}
	return false;
    }
开发者ID:Alex237,项目名称:svg-converter,代码行数:6,代码来源:emptynoderemoverstep.cpp

示例10: parseEntry

void ReadAndWriteXML::parseEntry(const QDomElement &element, QTreeWidgetItem *parent, int parentLevel)
{
 //   item->setText(0, element.attribute("term"));
    QDomNode node = element.firstChild();
    while (!node.isNull()) {
        //qDebug() << "DomParser::parseEntry  node " << node.toElement().tagName();
    //    qDebug() << "DomParser::parseEntry  parsing node " << node.nodeName();
         if (node.isElement()) {
            //qDebug() << "DomParser::parseEntry "<< node.nodeName()<< " is element ";
            QTreeWidgetItem *childitem=new QTreeWidgetItem(parent, QStringList(QString("Type: %1").arg(node.nodeName())));
            parseEntry(node.toElement(), childitem,++parentLevel);
            QString _attr="";
            if (node.hasAttributes()) {
               childitem=new QTreeWidgetItem(childitem, QStringList(QString("Attributes node %1").arg(node.nodeName())));
               parseAttribute(node.attributes(), childitem, parentLevel);
            }
            node = node.nextSibling();
            continue;
         }
         if (node.isCDATASection()) {
             //qDebug() << "DomParser::parseEntry "<< node.nodeName()<< " is CDATASection --" << node.toText().data() << "--";
             new QTreeWidgetItem(parent, QStringList(QString("Type: %1 Value: %2").arg(node.nodeName(),node.toText().data())));
             node = node.nextSibling();
             continue;
         }
         if (node.isComment()) {
            //qDebug() << "DomParser::parseEntry "<< node.nodeName()<< " is comment --" << node.toText().data() << "--";
            new QTreeWidgetItem(parent, QStringList(QString("Type: %1 Value: %2").arg(node.nodeName(),node.toText().data())));
            node = node.nextSibling();
            continue;
         }
         if (node.isText()) {
            //qDebug() << "DomParser::parseEntry "<< node.nodeName()<< " text --" << node.toText().data() << "--";
            new QTreeWidgetItem(parent, QStringList(QString("Type: %1 Value: %2").arg(node.nodeName(),node.toText().data())));
            node = node.nextSibling();
            continue;
         }
         if (node.isDocument()) {
            //qDebug() << "DomParser::parseEntry "<< node.nodeName()<< " is document ";
            QTreeWidgetItem *childitem=new QTreeWidgetItem(parent, QStringList(QString("Type: %1").arg(node.nodeName())));
            parseEntry(node.toElement(), childitem,++parentLevel);
            node = node.nextSibling();
            continue;
         }
         if (node.isDocumentType()) {
            qDebug() << "DomParser::parseEntry "<< node.nodeName()<< " is  document type";
            QTreeWidgetItem *childitem=new QTreeWidgetItem(parent, QStringList(QString("Type: %1").arg(node.nodeName())));
            parseEntry(node.toElement(), childitem,++parentLevel);
            node = node.nextSibling();
            continue;
         }
         if (node.isDocumentFragment()) {
            qDebug() << "DomParser::parseEntry "<< node.nodeName()<< " is  document fragment";
            QTreeWidgetItem *childitem=new QTreeWidgetItem(parent, QStringList(QString("Type: %1").arg(node.nodeName())));
            parseEntry(node.toElement(), childitem,++parentLevel);
            node = node.nextSibling();
            continue;
         }
         if (node.isEntity() || node.isEntityReference () || node.isNotation () || node.isProcessingInstruction ()) {
             qDebug() << "DomParser::parseEntry "<< node.nodeName()<< " is  not supported";
             node = node.nextSibling();
             continue;
         }

        node = node.nextSibling();
    }
}
开发者ID:lawrence-iviani,项目名称:DataHandler,代码行数:67,代码来源:readandwritexml.cpp

示例11: hasAttribute

//---------------------------------------------------------------------
// Utility functions
bool hasAttribute(const QDomNode &node, const QString &attr) {
	return (node.hasAttributes() && node.attributes().contains(attr));
}
开发者ID:odiofan,项目名称:StereoReconstruction,代码行数:5,代码来源:project.cpp

示例12: open

bool EpochIO::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask,const RichParameterSet & /*par*/, CallBackPos *cb, QWidget *parent)
{
  EpochReconstruction er;
	
  mask = vcg::tri::io::Mask::IOM_VERTCOLOR | vcg::tri::io::Mask::IOM_VERTQUALITY; 
// just to be sure...
	
	if (fileName.isEmpty()) return false;
		// initializing progress bar status
	if (cb != NULL) (*cb)(0, "Loading...");

	// this change of dir is needed for subsequent texture/material loading
	QString FileNameDir = fileName.left(fileName.lastIndexOf("/")); 
	QDir::setCurrent(FileNameDir);

	QString errorMsgFormat = "Error encountered while loading file %1:\n%2";
	string stdfilename = QFile::encodeName(fileName).constData ();
  //string filename = fileName.toUtf8().data();

	QDomDocument doc;
	
	if(formatName.toUpper() == tr("V3D") &&  fileName.endsWith(".v3d"))
	{
  		QFile file(fileName);
			if (file.open(QIODevice::ReadOnly) && doc.setContent(&file)) 
        {
					file.close();
					QDomElement root = doc.documentElement();
					if (root.nodeName() == tr("reconstruction")) 
          {
            QDomNode nhead = root.firstChildElement("head");
            for(QDomNode n = nhead.firstChildElement("meta"); !n.isNull(); n = n.nextSiblingElement("meta"))
              {
               if(!n.hasAttributes()) return false;
               QDomNamedNodeMap attr= n.attributes();
               if(attr.contains("name")) er.name = (attr.namedItem("name")).nodeValue() ;
               if(attr.contains("author")) er.author = (attr.namedItem("author")).nodeValue() ;
               if(attr.contains("created")) er.created = (attr.namedItem("created")).nodeValue() ;
              }    
             for(QDomNode n = root.firstChildElement("model"); !n.isNull(); n = n.nextSiblingElement("model"))
              {
                EpochModel em;
                em.Init(n);
                er.modelList.push_back(em);
              }
          }
        }
    }

	epochDialog->setEpochReconstruction( &er, cb);
  do
	{
			epochDialog->exportToPLY=false;
			
			//Here we invoke the modal dialog and wait for its termination
			int continueValue = epochDialog->exec();

			// The user has pressed the ok button: now start the real processing:
			
			if(epochDialog->exportToPLY == true) qDebug("Starting the ply exporting process");
			
			int t0=clock();
			logFP=fopen("epoch.log","w");

			int subSampleVal = epochDialog->subsampleSpinBox->value();
			int minCountVal= epochDialog->minCountSpinBox->value();
			float maxCCDiagVal= epochDialog->maxCCDiagSpinBox->value();
			int mergeResolution=epochDialog->mergeResolutionSpinBox->value();
			int smoothSteps=epochDialog->smoothSpinBox->value();
			bool closeHole = epochDialog->holeCheckBox->isChecked();
			int maxHoleSize = epochDialog->holeSpinBox->value();
			if (continueValue == QDialog::Rejected)
			{
					QMessageBox::warning(parent, "Open V3d format","Aborted");    
					return false;
			}
			CMeshO mm;
			QTableWidget *qtw=epochDialog->imageTableWidget;
			float MinAngleCos=cos(vcg::math::ToRad(epochDialog->qualitySpinBox->value()));
			bool clustering=epochDialog->fastMergeCheckBox->isChecked();
			bool removeSmallCC=epochDialog->removeSmallCCCheckBox->isChecked();
			vcg::tri::Clustering<CMeshO, vcg::tri::AverageColorCell<CMeshO> > Grid;

			int selectedNum=0,selectedCount=0;
			int i;
			 for(i=0;i<qtw->rowCount();++i) if(qtw->isItemSelected(qtw->item(i,0))) ++selectedNum;
			if(selectedNum==0)
				{
					QMessageBox::warning(parent, "Open V3d format","No range map selected. Nothing loaded");    
					return false;
			}

			bool dilationFlag = epochDialog->dilationCheckBox->isChecked();
			int dilationN = epochDialog->dilationNumPassSpinBox->value();
			int dilationSz = epochDialog->dilationSizeSlider->value() * 2 + 1;
			bool erosionFlag = epochDialog->erosionCheckBox->isChecked();
			int erosionN = epochDialog->erosionNumPassSpinBox->value();
			int erosionSz = epochDialog->erosionSizeSlider->value() * 2 + 1;
			float scalingFactor = epochDialog->scaleLineEdit->text().toFloat();
			std::vector<string> savedMeshVector;
//.........这里部分代码省略.........
开发者ID:Jerdak,项目名称:meshlab,代码行数:101,代码来源:epoch_io.cpp


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