您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ toQString函数代码示例

51自学网 2021-06-03 08:53:19
  C++
这篇教程C++ toQString函数代码示例写得很实用,希望能帮到您。

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

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

示例1: URLSearchPath

 /// Create a new URLSearchPath. /// /param[in] t_path local path to search /// /param[in] t_relativity If t_url is a relative path, it is evaluated relative to t_relativity. URLSearchPath(const openstudio::path &t_path, Relative t_relativity = ToInputFile)     : m_url(QUrl::fromLocalFile(toQString(t_path))), m_relativity(t_relativity) { }
开发者ID:urbanengr,项目名称:OpenStudio,代码行数:7,


示例2: toPath

/** UTF-8 encoded std::string to path*/path toPath(const std::string& s) {  return toPath(toQString(s));}
开发者ID:airguider,项目名称:OpenStudio,代码行数:5,


示例3: toVariant

  QVariant toVariant(const OSArgument& argument) {    QVariantMap argumentData;    argumentData["uuid"] = toQString(removeBraces(argument.uuid()));    argumentData["version_uuid"] = toQString(removeBraces(argument.versionUUID()));    argumentData["name"] = toQString(argument.name());    if (!argument.displayName().empty()) {      argumentData["display_name"] = toQString(argument.displayName());    }    if (argument.description() && !argument.description()->empty()) {      argumentData["description"] = toQString(argument.description().get());    }    OSArgumentType type = argument.type();    if (argument.units() && !argument.units()->empty()) {      argumentData["units"] = toQString(argument.units().get());    }    argumentData["type"] = toQString(type.valueName());    argumentData["required"] = argument.required();    argumentData["model_dependent"] = argument.modelDependent();    if (argument.hasValue()) {      if (type == OSArgumentType::Quantity) {        Quantity value = argument.valueAsQuantity();        argumentData["value"] = value.value();        argumentData["value_units"] = toQString(value.units().standardString());      }      else {        // use QVariant directly        argumentData["value"] = argument.valueAsQVariant();      }    }    if (argument.hasDefaultValue()) {      if (type == OSArgumentType::Quantity) {        Quantity defaultValue = argument.defaultValueAsQuantity();        argumentData["default_value"] = defaultValue.value();        argumentData["default_value_units"] = toQString(defaultValue.units().standardString());      }      else {        // use QVariant directly        argumentData["default_value"] = argument.defaultValueAsQVariant();      }    }    argumentData["domain_type"] = toQString(argument.domainType().valueName());    if (argument.hasDomain()) {      QVariantList domainList;      int index(0);      for (const QVariant& dval : argument.domainAsQVariant()) {        QVariantMap domainValueMap;        domainValueMap["domain_value_index"] = index;        if (type == OSArgumentType::Quantity) {          Quantity q = dval.value<openstudio::Quantity>();          domainValueMap["value"] = q.value();          domainValueMap["units"] = toQString(q.units().standardString());        }        else {          domainValueMap["value"] = dval;        }        domainList.push_back(domainValueMap);        ++index;      }      argumentData["domain"] = domainList;    }    if (type == OSArgumentType::Choice) {      QVariantList choicesList;      StringVector displayNames = argument.choiceValueDisplayNames();      int index(0), displayNamesN(displayNames.size());      for (const std::string& choice : argument.choiceValues()) {        QVariantMap choiceMap;        choiceMap["choice_index"] = index;        choiceMap["value"] = toQString(choice);        if (index < displayNamesN) {          choiceMap["display_name"] = toQString(displayNames[index]);        }        choicesList.push_back(choiceMap);        ++index;      }      argumentData["choices"] = QVariant(choicesList);    }    if (type == OSArgumentType::Path) {      argumentData["is_read"] = argument.isRead();      argumentData["extension"] = toQString(argument.extension());    }    return QVariant(argumentData);  }
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:84,


示例4: toQString

QEvent::Type JSEventMapper::findEventType( const KJS::Identifier &name ) const{    return  m_handlerToEvent[ toQString(name) ];}
开发者ID:vasi,项目名称:kdelibs,代码行数:4,


示例5: toQString

  void OutputAttributeVariableRecord_Impl::bindValues(QSqlQuery& query) const {    OutputVariableRecord_Impl::bindValues(query);    query.bindValue(OutputAttributeVariableRecord::ColumnsType::attributeName,                    toQString(m_attributeName));  }
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:6,


示例6: child

/* * ProcessSnapshotModel::Item::Item */ProcessSnapshotModel::Item::Item(PROCESSENTRY32& pe, Item *parent)         : child(NULL), exe(toQString(pe.szExeFile)), parent(parent),         isAttachable(false), pid(pe.th32ProcessID) {    HANDLE hProcess = NULL;     // Process handle.    HANDLE hToken = NULL;       // Process security token.    HANDLE hSnapshot = NULL;    // Snapshot of process modules.    MODULEENTRY32 me;           // For iterating modules.    if ((hProcess = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE,             this->pid)) != NULL) {        // TODO: System UNC path is too weird.        //char tmp[MAX_PATH];        //if (::GetProcessImageFileNameA(hProcess, tmp, MAX_PATH)) {        //    this->exe = QString(tmp);        //}            if (::OpenProcessToken(hProcess, TOKEN_QUERY, &hToken)) {                        /* User user information about process token. */            DWORD userInfoLen = 0;            if (::GetTokenInformation(hToken, TokenUser, NULL, 0, &userInfoLen)                     || (::GetLastError() == ERROR_INSUFFICIENT_BUFFER)) {                char *userInfo = new char[userInfoLen];                            if (::GetTokenInformation(hToken, TokenUser, userInfo,                         userInfoLen, &userInfoLen)) {                    PSID sid = reinterpret_cast<TOKEN_USER *>(                        userInfo)->User.Sid;                                    /* Lookup the user name of the SID. */                    DWORD userNameLen = 0;                    DWORD domainLen = 0;                    SID_NAME_USE snu = SidTypeUnknown;                    if (::LookupAccountSidA(NULL, sid, NULL, &userNameLen,                             NULL, &domainLen, &snu) || (::GetLastError()                             == ERROR_INSUFFICIENT_BUFFER)) {                        char *userName = new char[userNameLen];                        char *domain = new char[domainLen];                        if (::LookupAccountSidA(NULL, sid, userName,                                 &userNameLen, domain, &domainLen, &snu)) {                            this->owner = QString(domain) + "//"                                 + QString(userName);                            this->isAttachable = true;                            // Note: If we cannot get the owner SID, the owner                            // is probably SYSTEM and we cannot attach to                            // system processes.                        }                        delete[] userName;                        delete[] domain;                    }                }                    delete[] userInfo;            }            ::CloseHandle(hToken);        }        ::CloseHandle(hProcess);    }    /* Check whether the process has OpenGL loaded. */    if (this->isAttachable) {        this->isAttachable = false;        // Note: If we cannot enumerate the modules, we probably cannot attach,        // too, because of insufficient privileges.        if ((hSnapshot = ::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,                 this->pid)) != INVALID_HANDLE_VALUE) {            me.dwSize = sizeof(me);            if (::Module32First(hSnapshot, &me)) {                do {                    QString name = toQString(me.szModule);                    if (name.contains("opengl", Qt::CaseInsensitive)) {                        this->isAttachable = true;                        break;                    }                } while (::Module32Next(hSnapshot, &me));            }        }        ::CloseHandle(hSnapshot);    }    /* Attaching to the debugger is forbidden, too. */    if (this->pid == ::GetCurrentProcessId()) {        this->isAttachable = false;    }    // TODO: Should it be forbidden to attach to process that have the    // debug library already loaded?}
开发者ID:flyncode,项目名称:GLSL-Debugger,代码行数:95,


示例7: toQString

 QString ForwardTranslator::escapeName(const std::string& name) {   return toQString(name); }
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:4,


示例8: toQString

  boost::optional<QDomDocument> ForwardTranslator::translateModel(const openstudio::model::Model& model)  {    QDomDocument doc;    doc.createProcessingInstruction("xml", "version=/"1.0/" encoding=/"utf-8/"");    QDomElement sddElement = doc.createElement("SDDXML");    sddElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");    sddElement.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");    doc.appendChild(sddElement);    // set ruleset, where should this data come from?    QDomElement rulesetFilenameElement = doc.createElement("RulesetFilename");    sddElement.appendChild(rulesetFilenameElement);    rulesetFilenameElement.setAttribute("file", "CEC 2013 NonRes.bin"); // DLM: only allow one value for now    // set project, where should this data come from?    QDomElement projectElement = doc.createElement("Proj");    sddElement.appendChild(projectElement);    // DLM: what name to use here?    QDomElement projectNameElement = doc.createElement("Name");    projectElement.appendChild(projectNameElement);    projectNameElement.appendChild(doc.createTextNode("unknown"));    // site data    boost::optional<model::ClimateZones> climateZones = model.getOptionalUniqueModelObject<model::ClimateZones>();    if (climateZones){      // todo: check document year      std::vector<model::ClimateZone> zones = climateZones->getClimateZones("CEC");      if (zones.size() > 0 && !zones[0].value().empty()){        bool isNumber;        QString value = toQString(zones[0].value());        value.toInt(&isNumber);        if (isNumber){          value = QString("ClimateZone") + value;        }        QDomElement projectClimateZoneElement = doc.createElement("CliZn");        projectElement.appendChild(projectClimateZoneElement);        projectClimateZoneElement.appendChild(doc.createTextNode(value));        m_translatedObjects[climateZones->handle()] = projectClimateZoneElement;      }    }    // set lat, lon, elev    // DLM: do not translate forward,  Issue 242: Forward Translator - Remove Proj:Lat/Lon/Elevation translation    /*    boost::optional<model::Site> site = model.getOptionalUniqueModelObject<model::Site>();    if (site){      double latitude = site->latitude();      QDomElement latElement = doc.createElement("Lat");      projectElement.appendChild(latElement);      latElement.appendChild( doc.createTextNode(QString::number(latitude)));      double longitude = site->longitude();      QDomElement longElement = doc.createElement("Long");      projectElement.appendChild(longElement);      longElement.appendChild( doc.createTextNode(QString::number(longitude)));      double elevationSI = site->elevation();      double elevationIP = elevationSI/0.3048;      QDomElement elevationElement = doc.createElement("Elevation");      projectElement.appendChild(elevationElement);      elevationElement.appendChild( doc.createTextNode(QString::number(elevationIP)));      m_translatedObjects[site.handle()] = latElement;    }    */    // todo: write out epw file path    // todo: write out ddy file and set path    //<DDWeatherFile>C:/svn-CBECC-Com-130521/CBECC-Com13/Data/EPW/SACRAMENTO-EXECUTIVE_724830_CZ2010.ddy</DDWeatherFile>    //<AnnualWeatherFile>C:/svn-CBECC-Com-130521/CBECC-Com13/Data/EPW/SACRAMENTO-EXECUTIVE_724830_CZ2010.epw</AnnualWeatherFile>    //<HVACAutoSizing>1</HVACAutoSizing>    //<SimDsgnDays>1</SimDsgnDays>    //<RunPeriodBeginMonth>0</RunPeriodBeginMonth>    //<RunPeriodBeginDay>0</RunPeriodBeginDay>    //<RunPeriodEndMonth>0</RunPeriodEndMonth>    //<RunPeriodEndDay>0</RunPeriodEndDay>    //<RunPeriodYear>0</RunPeriodYear>    // do materials before constructions     std::vector<model::Material> materials = model.getModelObjects<model::Material>();    std::sort(materials.begin(), materials.end(), WorkspaceObjectNameLess());    if (m_progressBar){      m_progressBar->setWindowTitle(toString("Translating Materials"));      m_progressBar->setMinimum(0);      m_progressBar->setMaximum((int)materials.size());      m_progressBar->setValue(0);    }    for (const model::Material& material : materials){      boost::optional<QDomElement> materialElement = translateMaterial(material, doc);      if (materialElement){        projectElement.appendChild(*materialElement);      }//.........这里部分代码省略.........
开发者ID:urbanengr,项目名称:OpenStudio,代码行数:101,


示例9: toURL

QUrl toURL(const openstudio::path& p) {  return QUrl::fromLocalFile(toQString(p));}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:3,


示例10: QString

void OSIntegerEdit2::refreshTextAndLabel() {  QString text = this->text();  if (m_text == text) return;  if (m_modelObject) {    QString textValue;    ModelObject modelObject = m_modelObject.get();    std::stringstream ss;    if (m_isAutosized && (*m_isAutosized)()) {      textValue = QString("autosize");    }    if (m_isAutocalculated && (*m_isAutocalculated)()) {      textValue = QString("autocalculate");    }    OptionalInt oi;    if (m_get) {      oi = (*m_get)();    }    else {      OS_ASSERT(m_getOptional);      oi = (*m_getOptional)();    }    if (oi) {      int value = *oi;      if (m_isScientific) {        ss << std::scientific;      }      else {        ss << std::fixed;      }      if (m_precision) {        ss << std::setprecision(*m_precision);      }      ss << value;      textValue = toQString(ss.str());      ss.str("");    }    if (!textValue.isEmpty() && m_text != textValue){      m_text = textValue;      this->blockSignals(true);      this->setText(m_text);      this->blockSignals(false);    }    else {      return;    }    if (m_isDefaulted) {      if ((*m_isDefaulted)()) {        this->setStyleSheet("color:green");      }      else {        this->setStyleSheet("color:black");      }    }  }}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:63,


示例11: toPath

/// get the QApplication, if no QApplication has been set this will create a default oneQCoreApplication* ApplicationSingleton::application(bool gui){  if (!m_qApplication){    if (QCoreApplication::instance())    {      m_qApplication = QCoreApplication::instance();    } else {      QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);      QCoreApplication::setAttribute(Qt::AA_MacPluginApplication, true);      // Add this path for gem case (possibly deprecated)      QCoreApplication::addLibraryPath(toQString(getApplicationRunDirectory() / toPath("plugins")));      // And for any other random cases (possibly deprecated, applies to super-built Qt on Linux)      QCoreApplication::addLibraryPath(toQString(getApplicationRunDirectory().parent_path() / toPath("share/openstudio-" + openStudioVersion() + "/qtplugins")));      // Make the run path the backup plugin search location      QCoreApplication::addLibraryPath(toQString(getApplicationRunDirectory()));      // Make the ruby path the default plugin search location#if defined(Q_OS_MAC)      openstudio::path p = getApplicationRunDirectory().parent_path().parent_path().parent_path() / toPath("Ruby/openstudio");      QCoreApplication::addLibraryPath(toQString(p));#elif defined(Q_OS_WIN)      openstudio::path p = getApplicationRunDirectory().parent_path() / toPath("Ruby/openstudio");      QCoreApplication::addLibraryPath(toQString(p));#endif      static char *argv[] = {nullptr};      static int argc = sizeof(argv) / sizeof(char*) - 1;      // Load the qpa plugin (If SketchUp is loading the OpenStudio plugin, the SketchUp run path will be added to the end of libraryPaths)      if (gui){        m_qApplication = new QApplication(argc, argv);        dynamic_cast<QApplication*>(m_qApplication)->setQuitOnLastWindowClosed(false);      }else{        m_qApplication = new QCoreApplication(argc, argv);      }            m_defaultInstance = true;      // check if we are in a SketchUp process      #if _WIN32 || _MSC_VER        if (gui){          DWORD pId = GetCurrentProcessId();          //HMODULE hModule = GetModuleHandle(NULL); // same as hInstance          LPTSTR className = new TCHAR[255];          LPTSTR typeName = new TCHAR[255];          HWND h = GetTopWindow(0);          while (h)          {            DWORD pId2;            GetWindowThreadProcessId(h, &pId2);            if (pId == pId2){              GetClassName(h, className, 255);              GetWindowText(h, typeName, 255);              if (boost::regex_match(toString(typeName), boost::regex(".*- SketchUp.*"))){                m_sketchUpWidget = new QWinWidget(h);                break;              }            }            h = GetNextWindow(h, GW_HWNDNEXT);          }          delete[] className;          delete[] typeName;        }      #endif    }  }  return m_qApplication;}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:84,


示例12: addPropertyName

void ExternalObjectInterface::addPropertyName(const std::string& name){  m_propertyNames.push_back(toQString(name));}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:4,


示例13: tr

void MeasuresTabController::selectBaseline(){  boost::optional<analysisdriver::SimpleProject> project = PatApp::instance()->project();  if (!project){    return;  }  if (project->isRunning()){    // warn user that they will have to stop running to change baseline model    QMessageBox::StandardButton test = QMessageBox::question( measuresTabView, "Stop Current Analysis?", "You must stop the currently running analysis before changing the baseline model, do you want to proceed?", QMessageBox::Yes |  QMessageBox::No, QMessageBox::No );    if (test == QMessageBox::No){      return;    }    project->stop();  }  if (project->analysis().completeDataPoints().size() > 0u){    // warn user that this will blow away their data points    QMessageBox::StandardButton test = QMessageBox::question(         measuresTabView,         "Change Baseline Model?",         "Changing your baseline model will remove all results and save your project, do you want to proceed?",         QMessageBox::Yes |  QMessageBox::No,         QMessageBox::No );    if (test == QMessageBox::No){      return;    }  }  // DLM: todo, allow user to clear baseline?  QString fileName = QFileDialog::getOpenFileName( measuresTabView,                                                   tr("Select Baseline Model"),                                                   QDir::homePath(),                                                   tr("(*.osm)") );  if (!fileName.isEmpty()){    QDir projectDir(toQString(project->projectDir()));    if (projectDir.relativeFilePath(fileName).startsWith("seed")){      QMessageBox::warning( measuresTabView, "Changing Baseline Model Failed", QString("The new baseline model cannot be located within the project's seed directory."));      return;    }    FileReference seed(toPath(fileName));    // DLM: make sure to call setSeed on the real project, not a copy    if (PatApp::instance()->setSeed(seed)){      if (seed.displayName().empty() || seed.displayName() == "*"){        measuresTabView->baselineCautionLabel->setHidden(false);        measuresTabView->baselineNameBackground->setHidden(true);        measuresTabView->baselineLabel->setText(QString());      }else{        measuresTabView->baselineCautionLabel->setHidden(true);        measuresTabView->baselineNameBackground->setHidden(false);        measuresTabView->baselineLabel->setText(toQString(seed.displayName()));      }      // change cannot be undone, save the project      PatApp::instance()->project()->save();      //QMessageBox::information( measuresTabView, "Baseline Model Changed", QString("Baseline model has been changed, please run a baseline simulation with this new baseline model before continuing on with new work.") );      m_variableGroupListController->selectionController()->unselectAllItems();    }else{      // tell user that this failed      QMessageBox::critical( measuresTabView, "Changing Baseline Model Failed", QString("Failed to change baseline model to file at '") + fileName + QString("'."));    }  }}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:70,


示例14: toQString

bool QSanProtocol::Utils::tryParse(const Json::Value &arg, QString &result) {    if (!arg.isString()) return false;    result = toQString(arg);    return true;}
开发者ID:Jia731,项目名称:QSanguosha-For-Hegemony,代码行数:5,


示例15: modelObjectToItemId

OSItemId modelObjectToItemId(const openstudio::model::ModelObject& modelObject, bool isDefaulted){  std::stringstream ss;  ss << modelObject;  return OSItemId(modelObject.handle().toString(), modelToSourceId(modelObject.model()), isDefaulted, toQString(ss.str()));}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:6,


示例16: toString

 std::string BCLFileReference::fileType() const {   return toString(toQString(m_path.extension()).replace(".", "")); }
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:4,


示例17: toString

/** wstring to std::string. */std::string toString(const std::wstring& w){  return toString(toQString(w));}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:5,


示例18: dirFile

 FileInfo RunManager_Util::dirFile(const openstudio::path &p) {   return dirFile(QFileInfo(toQString(p))); }
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:4,


示例19: QString

QString CleanupTab::pathString(const TFilePath &path, bool lpNone){	return path.isEmpty() ? lpNone ? QString("+extras") : QString("+drawings") : toQString(path);}
开发者ID:CroW-CZ,项目名称:opentoonz,代码行数:4,


示例20: toQString

/** path to QString. */QString toQString(const path& p) {  return toQString(p.string());}
开发者ID:airguider,项目名称:OpenStudio,代码行数:5,


示例21: fopen

void RenderCommand::flashRender(){	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();	TSceneProperties *sprop = scene->getProperties();	FILE *fileP = fopen(m_fp, "wb");	if (!fileP)		return;	ProgressDialog pb("rendering " + toQString(m_fp), "Cancel", 0, m_numFrames);	pb.show();	TDimension cameraSize = scene->getCurrentCamera()->getRes();	double frameRate = sprop->getOutputProperties()->getFrameRate();	TFlash flash(		cameraSize.lx,		cameraSize.ly,		m_numFrames,		frameRate,		sprop->getOutputProperties()->getFileFormatProperties("swf"));	flash.setBackgroundColor(sprop->getBgColor());	std::vector<TXshSoundColumn *> columns;	scene->getSoundColumns(columns);	if (!columns.empty()) {		TXsheet::SoundProperties *prop = new TXsheet::SoundProperties();		prop->m_frameRate = frameRate;		TSoundTrack *st = scene->getXsheet()->makeSound(prop);		if (st)			flash.putSound(st, 0);	}	int i = 0;	for (i = 0; i < m_numFrames; ++i, m_r += m_stepd) {		flash.beginFrame(m_step * i + 1);		TRasterFxP rfx = buildSceneFx(scene, m_r, 0, false);		assert(rfx);		rfx->compute(flash, tround(m_r)); // WARNING: This should accept a DOUBLE...#ifdef BRAVODEMO		TRasterImageP ri(loadBravo(scene->getCurrentCamera()->getRes()));		int lx = ri->getRaster()->getLx();		int ly = ri->getRaster()->getLx();		flash.pushMatrix();		int dx = tround(0.1 * (cameraSize.lx - lx));		int dy = tround(0.1 * (cameraSize.ly - ly));		flash.multMatrix(TTranslation((cameraSize.lx - lx) / 2 - (dx > 0 ? dx : 0), -(cameraSize.ly - ly) / 2 + (dy > 0 ? dy : 0)));		flash.draw(ri, 0);		flash.popMatrix();#endif		flash.endFrame(i == m_numFrames - 1, 0, true);		if (pb.wasCanceled())			break;		pb.setValue(i + 1);	}	flash.writeMovie(fileP);	fclose(fileP);	TSystem::showDocument(m_fp);	//QDesktopServices::openUrl(QUrl(toQString(m_fp)));	TImageCache::instance()->remove(toString(m_fp.getWideString() + L".0"));	TNotifier::instance()->notify(TSceneNameChange());}
开发者ID:ArseniyShestakov,项目名称:opentoonz,代码行数:62,


示例22: toString

/** path to UTF-8 encoding. */std::string toString(const path& p) {  return toString(toQString(p));}
开发者ID:airguider,项目名称:OpenStudio,代码行数:5,


示例23: m_directory

  // Downloaded component from component.xml  BCLComponent::BCLComponent(const std::string& dir):    m_directory(dir)  {    QDomDocument component("component.xml");    QFile file(toQString(m_directory+"/component.xml"));    file.open(QIODevice::ReadOnly | QIODevice::Text);    component.setContent(&file);    file.close();    QDomElement comp = component.firstChildElement("component");    m_name = comp.firstChildElement("name").firstChild().nodeValue().replace("_", " ")      .toStdString();    m_uid = comp.firstChildElement("uid").firstChild().nodeValue().toStdString();    m_versionId = comp.firstChildElement("version_id").firstChild().nodeValue().toStdString();    m_description = comp.firstChildElement("description").firstChild().nodeValue().toStdString();    QDomElement componentElement = comp.firstChildElement("files").firstChildElement("file");    while (!componentElement.isNull())    {      if (componentElement.hasChildNodes())      {        m_files.push_back(componentElement.firstChildElement("filename").firstChild()          .nodeValue().toStdString());        m_filetypes.push_back(componentElement.firstChildElement("filetype").firstChild()          .nodeValue().toStdString());      }      else      {        break;      }      componentElement = componentElement.nextSiblingElement("file");    }    componentElement = comp.firstChildElement("attributes").firstChildElement("attribute");    while (!componentElement.isNull())    {      if (componentElement.hasChildNodes())      {        std::string name = componentElement.firstChildElement("name").firstChild()          .nodeValue().toStdString();        std::string value = componentElement.firstChildElement("value").firstChild()          .nodeValue().toStdString();        std::string datatype = componentElement.firstChildElement("datatype").firstChild()          .nodeValue().toStdString();        // Units are optional        std::string units = componentElement.firstChildElement("units").firstChild()          .nodeValue().toStdString();        if (datatype == "float"){          if (units.empty()){            Attribute attr(name, boost::lexical_cast<double>(value));            m_attributes.push_back(attr);          }else{            Attribute attr(name, boost::lexical_cast<double>(value), units);            m_attributes.push_back(attr);          }        }else if (datatype == "int"){          if (units.empty()){            Attribute attr(name, boost::lexical_cast<int>(value));            m_attributes.push_back(attr);          }else{            Attribute attr(name, boost::lexical_cast<int>(value), units);            m_attributes.push_back(attr);          }        }else if (datatype == "boolean"){          bool temp;          if (value == "true"){            temp = true;          }else{            temp = false;          }          if (units.empty()){            Attribute attr(name, temp);            m_attributes.push_back(attr);          }else{            Attribute attr(name, temp, units);            m_attributes.push_back(attr);          }        }else{          // Assume string          if (units.empty()){            Attribute attr(name, value);            m_attributes.push_back(attr);          }else{            Attribute attr(name, value, units);            m_attributes.push_back(attr);          }        }      }      else      {        break;      }      componentElement = componentElement.nextSiblingElement("attribute");    }  }
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:97,


示例24: co

void ApplyMeasureNowDialog::runMeasure(){  runmanager::ConfigOptions co(true);  if (co.getTools().getAllByName("ruby").tools().size() == 0)   {    QMessageBox::information(this,      "Missing Ruby",      "Ruby could not be located./nOpenStudio will scan for tools.",      QMessageBox::Ok);    co.findTools(true);    openstudio::runmanager::RunManager rm;    rm.setConfigOptions(co);    rm.showConfigGui();    rm.getConfigOptions().saveQSettings();    emit toolsUpdated();    if (co.getTools().getAllByName("ruby").tools().size() == 0)    {      QMessageBox::information(this,        "Missing Ruby",        "Ruby was not located by tool search./nPlease ensure Ruby correctly installed./nSimulation aborted.",        QMessageBox::Ok);      m_mainPaneStackedWidget->setCurrentIndex(m_inputPageIdx);      m_timer->stop();      this->okButton()->hide();      this->backButton()->hide();      return;    }  }  m_mainPaneStackedWidget->setCurrentIndex(m_runningPageIdx);  m_timer->start(50);  this->okButton()->hide();  this->backButton()->hide();  OS_ASSERT(m_model);  openstudio::OSAppBase * app = OSAppBase::instance();  m_workingDir = openstudio::toPath(app->currentDocument()->modelTempDir()) / openstudio::toPath("ApplyMeasureNow");  openstudio::path modelPath = m_workingDir / openstudio::toPath("modelClone.osm");  openstudio::path epwPath; // DLM: todo look at how this is done in the run tab  removeWorkingDir();    // save cloned model to temp directory  m_model->save(modelPath,true);   // remove? this is shown only in debug (EW)  QString path("Measure Output Location: ");  path.append(toQString(m_workingDir));  m_jobPath->setText(path);  analysis::RubyMeasure rubyMeasure = m_currentMeasureItem->measure();  // DLM: should be able to assert this  bool hasIncompleteArguments = m_currentMeasureItem->hasIncompleteArguments();  OS_ASSERT(!hasIncompleteArguments);  runmanager::RubyJobBuilder rjb(*m_bclMeasure, rubyMeasure.arguments());  openstudio::path p = getOpenStudioRubyIncludePath();  QString arg = "-I";  arg.append(toQString(p));  rjb.addToolArgument(arg.toStdString());  openstudio::runmanager::Workflow wf;  rjb.addToWorkflow(wf);  wf.add(co.getTools());  wf.setInputFiles(modelPath, openstudio::path());  m_job = wf.create(m_workingDir, modelPath);  // DLM: you could make rm a class member then you would not have to call waitForFinished here  runmanager::RunManager rm;  bool queued = rm.enqueue(*m_job, true);  OS_ASSERT(queued);  std::vector<runmanager::Job> jobs = rm.getJobs();  OS_ASSERT(jobs.size() == 1);  rm.waitForFinished ();  QTimer::singleShot(0, this, SLOT(displayResults()));}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:87,


示例25: showMyMeasuresFolder

void LocalLibraryController::showMyMeasuresFolder(){  openstudio::path userMeasuresDir = BCLMeasure::userMeasuresDir();  QString path = QDir::toNativeSeparators(toQString(userMeasuresDir));  QDesktopServices::openUrl(QUrl("file:///" + path));}
开发者ID:Rahjou,项目名称:OpenStudio,代码行数:6,



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


C++ toRadians函数代码示例
C++ toPrettyChars函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。