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


C++ QStringList::push_back方法代码示例

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


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

示例1: CompletionFailure


//.........这里部分代码省略.........
            auto j = 0u
          , chunks = clang_getNumCompletionChunks(str)
          ; j < chunks && !skip_this_item
          ; ++j
          )
        {
            auto kind = clang_getCompletionChunkKind(str, j);
            auto text = toString(clang::DCXString{clang_getCompletionChunkText(str, j)});
            switch (kind)
            {
                // Text that a user would be expected to type to get this code-completion result
                case CXCompletionChunk_TypedText:
                // Text that should be inserted as part of a code-completion result
                case CXCompletionChunk_Text:
                {
                    auto p = sanitize(text, sanitize_rules);// Pipe given piece of text through sanitizer
                    if (p.first)
                        typed_text += p.second;
                    else                                    // Go for next completion item
                        skip_this_item = true;
                    break;
                }
                // Placeholder text that should be replaced by the user
                case CXCompletionChunk_Placeholder:
                {
                    auto p = sanitize(text, sanitize_rules);// Pipe given piece of text through sanitizer
                    if (p.first)
                    {
                        appender(
                            QLatin1String{"%"}
                          + QString::number(placeholders.size() + 1)
                          + QLatin1String{"%"}
                          );
                        placeholders.push_back(p.second);
                    }
                    else                                    // Go for next completion item
                        skip_this_item = true;
                    break;
                }
                // A code-completion string that describes "optional" text that
                // could be a part of the template (but is not required)
                case CXCompletionChunk_Optional:
                {
                    auto ostr = clang_getCompletionChunkCompletionString(str, j);
                    for (
                        auto oci = 0u
                      , ocn = clang_getNumCompletionChunks(ostr)
                      ; oci < ocn
                      ; ++oci
                      )
                    {
                        auto otext = toString(clang::DCXString{clang_getCompletionChunkText(ostr, oci)});
                        // Pipe given piece of text through sanitizer
                        auto p = sanitize(otext, sanitize_rules);
                        if (p.first)
                        {
                            auto okind = clang::kind_of(ostr, oci);
                            if (okind == CXCompletionChunk_Placeholder)
                            {
                                appender(
                                    QLatin1String{"%"}
                                  + QString::number(placeholders.size() + 1)
                                  + QLatin1String{"%"}
                                  );
                                placeholders.push_back(p.second);
                                optional_placeholers_start_position = placeholders.size();
开发者ID:zaufi,项目名称:kate-cpp-helper-plugin,代码行数:67,代码来源:translation_unit.cpp

示例2: ToStringList

void TunedInputInfo::ToStringList(QStringList &list) const
{
    InputInfo::ToStringList(list);
    list.push_back(QString::number(chanid));
}
开发者ID:ChristopherNeufeld,项目名称:mythtv,代码行数:5,代码来源:inputinfo.cpp

示例3: loadGroupingXMLtoTable

/**
 * load XML grouping file. It is assumed that tables and combo box cleared before this method is called
 */
void loadGroupingXMLtoTable(Ui::MuonAnalysis& m_uiForm, const std::string& filename)
{
  // Set up the DOM parser and parse xml file
  DOMParser pParser;
  Document* pDoc;
  try
  {
    pDoc = pParser.parse(filename);
  }
  catch(...)
  {
    throw Mantid::Kernel::Exception::FileError("Unable to parse File:" , filename);
  }
  // Get pointer to root element
  Element* pRootElem = pDoc->documentElement();
  if ( !pRootElem->hasChildNodes() )
  {
    throw Mantid::Kernel::Exception::FileError("No root element in XML grouping file:" , filename);
  }  

  NodeList* pNL_group = pRootElem->getElementsByTagName("group");
  if ( pNL_group->length() == 0 )
  {
    throw Mantid::Kernel::Exception::FileError("XML group file contains no group elements:" , filename);
  }


  // add content to group table

  QStringList allGroupNames;  // used to populate combo boxes 
  int numberGroups = static_cast<int>(pNL_group->length());
  for (int iGroup = 0; iGroup < numberGroups; iGroup++)
  {
    Element* pGroupElem = static_cast<Element*>(pNL_group->item(iGroup));

    if ( !pGroupElem->hasAttribute("name") )
      throw Mantid::Kernel::Exception::FileError("Group element without name" , filename);
    std::string gName = pGroupElem->getAttribute("name");


    Element* idlistElement = pGroupElem->getChildElement("ids");
    if (idlistElement)
    {
      std::string ids = idlistElement->getAttribute("val");

      // add info to table
      m_uiForm.groupTable->setItem(iGroup, 0, new QTableWidgetItem(gName.c_str()) );
      m_uiForm.groupTable->setItem(iGroup,1, new QTableWidgetItem(ids.c_str()) );
      allGroupNames.push_back( m_uiForm.groupTable->item(static_cast<int>(iGroup),0)->text() );
    }
    else
    {
      throw Mantid::Kernel::Exception::FileError("XML group file contains no <ids> elements:" , filename);
    }   
  }
  pNL_group->release();
  

  // populate pair table combo boxes

  int rowNum = m_uiForm.pairTable->rowCount();
  for (int i = 0; i < rowNum; i++)
  {
    QComboBox* qw1 = static_cast<QComboBox*>(m_uiForm.pairTable->cellWidget(i,1));
    QComboBox* qw2 = static_cast<QComboBox*>(m_uiForm.pairTable->cellWidget(i,2));

    for (int ii = 0; ii < allGroupNames.size(); ii++)
    {

      qw1->addItem( allGroupNames[ii] );
      qw2->addItem( allGroupNames[ii] );
    }
    
    if ( qw2->count() > 1 )
      qw2->setCurrentIndex(1);
  }




  // add content to pair table

  QStringList allPairNames;  
  NodeList* pNL_pair = pRootElem->getElementsByTagName("pair");
  int nPairs = static_cast<int>(pNL_pair->length());
  if ( pNL_pair->length() > 0 )
  {
    for (int iPair = 0; iPair < nPairs; iPair++)
    {
      Element* pGroupElem = static_cast<Element*>(pNL_pair->item(iPair));

      if ( !pGroupElem->hasAttribute("name") )
        throw Mantid::Kernel::Exception::FileError("pair element without name" , filename);
      std::string gName = pGroupElem->getAttribute("name");
      m_uiForm.pairTable->setItem(iPair,0, new QTableWidgetItem(gName.c_str()) );
      allPairNames.push_back(gName.c_str());

//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例4: main

int main(int argc, char *argv[])
{
    appPath = argv[0];
    printf("\nQt Creator Debugging Helper testing tool\n\n");
    printf("Running query protocol\n");
    qDumpObjectData440(1, 42, 0, 1, 0, 0, 0, 0);
    fputs(qDumpOutBuffer, stdout);
    fputc('\n', stdout);
    fputc('\n', stdout);

    const TypeDumpFunctionMap tdm = registerTypes();
    const TypeDumpFunctionMap::const_iterator cend = tdm.constEnd();

    if (argc < 2) {
        usage(argv[0], tdm);
        return 0;
    }
    // Parse args
    QStringList tests;
    for (int a = 1; a < argc; a++) {
        const char *arg = argv[a];
        if (arg[0] == '-') {
            switch (arg[1]) {
            case 'a':
                optTestAll = true;
                break;
            case 'u':
                optTestUninitialized = true;
                break;
            case 'v':
                optVerbose++;
                break;
            case 'e':
                optEmptyContainers = true;
                break;
            default:
                fprintf(stderr, "Invalid option %s\n", arg);
                usage(argv[0], tdm);
                return -1;
            }
        } else {
            tests.push_back(QLatin1String(arg));
        }
    }
    // Go
    int rc = 0;
    if (optTestAll) {
        for (TypeDumpFunctionMap::const_iterator it = tdm.constBegin(); it != cend; ++it) {
            const QString test = it.key();
            if (tests.contains(test)) {
                printf("\nSkipping: %s\n", qPrintable(test));
            } else {
                printf("\nTesting: %s\n", qPrintable(test));
                rc += (*it.value())();
                if (optTestUninitialized)
                    printf("Survived: %s\n", qPrintable(test));
            }
        }
    } else {
        foreach(const QString &test, tests) {
            printf("\nTesting: %s\n", qPrintable(test));
            const TypeDumpFunctionMap::const_iterator it = tdm.constFind(test);
            if (it == cend) {
                rc = -1;
                fprintf(stderr, "\nUnhandled type: %s\n", qPrintable(test));
            } else {
                rc = (*it.value())();
            }
        }
    }
开发者ID:MECTsrl,项目名称:imx_mect,代码行数:70,代码来源:main.cpp

示例5: dragLeaveEvent

void DnDEventLoggerWidget::dragLeaveEvent(QDragLeaveEvent *e)
{
    e->accept();
    m_log->push_back(objectName() + QLatin1String("::") + QLatin1String("dragLeaveEvent") + QLatin1String(" QDragLeaveEvent"));
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:5,代码来源:tst_qwidget_window.cpp

示例6: main

int main(int argc, char **argv)
{
  QApplication::setOrganizationName("KDAB");
  QApplication::setOrganizationDomain("kdab.com");
  QApplication::setApplicationName("GammaRay");

  QStringList args;
  for (int i = 1; i < argc; ++i) {
    args.push_back(QString::fromLocal8Bit(argv[i]));
  }
  QApplication app(argc, argv);

  QStringList builtInArgs = QStringList() << QLatin1String("-style")
                                          << QLatin1String("-stylesheet")
                                          << QLatin1String("-graphicssystem");

  QString injectorType;
  int pid = -1;
  while (!args.isEmpty() && args.first().startsWith('-')) {
    const QString arg = args.takeFirst();
    if ((arg == QLatin1String("-i") || arg == QLatin1String("--injector")) && !args.isEmpty()) {
      injectorType = args.takeFirst();
      continue;
    }
    if ((arg == QLatin1String("-p") || arg == QLatin1String("--pid")) && !args.isEmpty()) {
      pid = args.takeFirst().toInt();
      continue;
    }
    if (arg == QLatin1String("-h") || arg == QLatin1String("--help")) {
      usage(argv[0]);
      return 0;
    }
    if (arg == QLatin1String("-v") || arg == QLatin1String("--version")) {
      out << PROGRAM_NAME << " version " << GAMMARAY_VERSION_STRING << endl;
      out << "Copyright (C) 2010-2012 Klaralvdalens Datakonsult AB, "
          << "a KDAB Group company, [email protected]" << endl;
      return 0;
    }
    if (arg == QLatin1String("-filtertest")) {
      qputenv("GAMMARAY_TEST_FILTER", "1");
    }
    if (arg == QLatin1String("-unittest")) {
      qputenv("GAMMARAY_UNITTEST", "1");
    }
    if (arg == QLatin1String("-modeltest")) {
      qputenv("GAMMARAY_MODELTEST", "1");
    }
    // built-in arguments of QApp, could be meant for us if we are showing the launcher window
    foreach (const QString &builtInArg, builtInArgs) {
      if (arg == builtInArg && !args.isEmpty()) {
        args.takeFirst();
      }
    }
  }

  if (args.isEmpty() && pid <= 0) {
    LauncherWindow dialog;
    if (dialog.exec() == QDialog::Accepted) {
      args = dialog.launchArguments();
      bool ok;
      pid = dialog.pid().toInt(&ok);
      if (!ok && args.isEmpty()) {
        return 0;
      }
    } else {
      return 0;
    }
  }

  const QString probeDll = ProbeFinder::findProbe(QLatin1String("gammaray_probe"));
  qputenv("GAMMARAY_PROBE_PATH", QFileInfo(probeDll).absolutePath().toLocal8Bit());

  AbstractInjector::Ptr injector;
  if (injectorType.isEmpty()) {
    if (pid > 0) {
      injector = InjectorFactory::defaultInjectorForAttach();
    } else {
      injector = InjectorFactory::defaultInjectorForLaunch();
    }
  } else {
    injector = InjectorFactory::createInjector(injectorType);
  }

  if (injector) {
    if (pid > 0) {
      if (!injector->attach(pid, probeDll, QLatin1String("gammaray_probe_inject"))) {
        err << "Unable to attach injector " << injector->name() << endl;
        err << "Exit code: " << injector->exitCode() << endl;
        if (!injector->errorString().isEmpty()) {
          err << "Error: " << injector->errorString() << endl;
        }
        return 1;
      } else {
        return 0;
      }
    } else {
      if (!injector->launch(args, probeDll, QLatin1String("gammaray_probe_inject"))) {
        err << "Failed to launch injector " << injector->name() << endl;
        err << "Exit code: " << injector->exitCode() << endl;
        if (!injector->errorString().isEmpty()) {
//.........这里部分代码省略.........
开发者ID:debfx,项目名称:GammaRay,代码行数:101,代码来源:main.cpp

示例7: prepare

int prepare(QFileInfo f, QStringList paths) {
	if (paths.isEmpty()) {
		cout << "No -path args were passed :(\n";
		return -1;
	}

	int lastVersion = 0;
	QString lastVersionStr;
	QFileInfo last;
	QFileInfoList l = f.absoluteDir().entryInfoList(QDir::Files);
	for (QFileInfoList::iterator i = l.begin(), e = l.end(); i != e; ++i) {
		QRegularExpressionMatch m = QRegularExpression("/tsetup.((\\d+).(\\d+).(\\d+)).exe$").match(i->absoluteFilePath());
		if (!m.hasMatch()) continue;

		int version = m.captured(2).toInt() * 1000000 + m.captured(3).toInt() * 1000 + m.captured(4).toInt();
		if (version > lastVersion) {
			lastVersion = version;
			lastVersionStr = m.captured(1);
			last = *i;
		}
	}

	if (!lastVersion) {
		cout << "No tsetup.X.Y.Z.exe found :(\n";
		return -1;
	}

	cout << "Last version: " << lastVersionStr.toUtf8().constData() << " (" << lastVersion << "), executing packer..\n";

	QDir dir("deploy/" + lastVersionStr);
	if (dir.exists()) {
		cout << "Version " << lastVersionStr.toUtf8().constData() << " already exists in /deploy..\n";
		return -1;
	}

	QString packer = QString("Packer.exe -version %1").arg(lastVersion);
	for (QStringList::iterator i = paths.begin(), e = paths.end(); i != e; ++i) {
		packer += " -path " + *i;
	}

	int res = system(packer.toUtf8().constData());

	if (res) return res;

	dir.mkpath(".");

	paths.push_back("Telegram.pdb");
	paths.push_back("Updater.pdb");
	paths.push_back("tsetup." + lastVersionStr + ".exe");
	paths.push_back(QString("tupdate%1").arg(lastVersion));
	for (QStringList::iterator i = paths.begin(), e = paths.end(); i != e; ++i) {
		if (!QFile::copy(*i, "deploy/" + lastVersionStr + "/" + *i)) {
			cout << "Could not copy " << i->toUtf8().constData() << " to deploy/" << lastVersionStr.toUtf8().constData() << "\n";
			return -1;
		}
		cout << "Copied " << i->toUtf8().constData() << "..\n";
	}
	for (QStringList::iterator i = paths.begin(), e = paths.end(); i != e; ++i) {
		QFile::remove(*i);
	}

	cout << "Update created in deploy/" << lastVersionStr.toUtf8().constData() << "\n";

	return 0;
}
开发者ID:AmesianX,项目名称:tdesktop,代码行数:65,代码来源:prepare.cpp

示例8: if

FilterChain *FilterManager::LoadFilters(QString Filters,
                                        VideoFrameType &inpixfmt,
                                        VideoFrameType &outpixfmt, int &width,
                                        int &height, int &bufsize,
                                        int max_threads)
{
    if (Filters.toLower() == "none")
        return nullptr;

    vector<const FilterInfo*> FiltInfoChain;
    FilterChain *FiltChain = new FilterChain;
    vector<FmtConv*> FmtList;
    const FilterInfo *FI;
    const FilterInfo *FI2;
    QString Opts;
    const FilterInfo *Convert = GetFilterInfo("convert");
    QStringList OptsList;
    QStringList FilterList = Filters.split(",", QString::SkipEmptyParts);
    VideoFilter *NewFilt = nullptr;
    FmtConv *FC, *FC2, *S1, *S2, *S3;
    VideoFrameType ifmt;
    int nbufsize;
    int cbufsize;
    int postfilt_width = width;
    int postfilt_height = height;

    for (auto i = FilterList.begin(); i != FilterList.end(); ++i)
    {
        QString FiltName = (*i).section('=', 0, 0);
        QString FiltOpts = (*i).section('=', 1);

        if (FiltName.contains("opengl", Qt::CaseInsensitive) ||
            FiltName.contains("vdpau",  Qt::CaseInsensitive))
            continue;

        FI = GetFilterInfo(FiltName);

        if (FI)
        {
            FiltInfoChain.push_back(FI);
            OptsList.push_back(FiltOpts);
        }
        else
        {
            LOG(VB_GENERAL, LOG_ERR, LOC +
                QString("Failed to load filter '%1', "
                        "no such filter exists").arg(FiltName));
            FiltInfoChain.clear();
            break;
        }
    }

    ifmt = inpixfmt;
    for (uint i = 0; i < FiltInfoChain.size(); i++)
    {
        S1 = S2 = S3 = nullptr;
        FI = FiltInfoChain[i];
        if (FiltInfoChain.size() - i == 1)
        {
            for (FC = FI->formats; FC->in != FMT_NONE; FC++)
            {
                if (FC->out == outpixfmt && FC->in == ifmt)
                {
                    S1 = FC;
                    break;
                }
                if (FC->in == ifmt && !S2)
                    S2 = FC;
                if (FC->out == outpixfmt && !S3)
                    S3 = FC;
            }
        }
        else
        {
            FI2 = FiltInfoChain[i+1];
            for (FC = FI->formats; FC->in != FMT_NONE; FC++)
            {
                for (FC2 = FI2->formats; FC2->in != FMT_NONE; FC2++)
                {
                    if (FC->in == ifmt && FC->out == FC2->in)
                    {
                        S1 = FC;
                        break;
                    }
                    if (FC->out == FC2->in && !S3)
                        S3 = FC;
                }
                if (S1)
                    break;
                if (FC->in == ifmt && !S2)
                    S2 = FC;
            }
        }

        if (S1)
            FC = S1;
        else if (S2)
            FC = S2;
        else if (S3)
            FC = S3;
//.........这里部分代码省略.........
开发者ID:garybuhrmaster,项目名称:mythtv,代码行数:101,代码来源:filtermanager.cpp

示例9: parseDocumentToStringlist


//.........这里部分代码省略.........
			{
				// get next character of this entity
				parseentity.append( ch );
				continue;
			}
				
			// The entity ended
			state = STATE_OUTSIDE_TAGS;
			
			// Some shitty HTML does not terminate entities correctly. Screw it.			
			if ( ch != ';' && ch != '<' )
			{
				if ( parseentity.isEmpty() )
				{
					// straight '&' symbol. Add and continue.
					parsedbuf += "&";
				}
				else
					qWarning( "Index::parseDocument: incorrectly terminated HTML entity '&%s%c', ignoring", qPrintable( parseentity ), ch.toLatin1() );
				
				j--; // parse this character again, but in different state
				continue;
			}
			
			// Don't we have a space?
			if ( parseentity.toLower() != "nbsp" )
			{
				QString entity = entityDecoder.decode( parseentity );
			
				if ( entity.isNull() )
				{
					// decodeEntity() already printed error message
					//qWarning( "Index::parseDocument: failed to decode entity &%s;", parsedbuf.ascii() );
					continue;
				}
			
				parsedbuf += entity;
				continue;
			}
			else
				ch = ' '; // We got a space, so treat it like it, and not add it to parsebuf
		}
		
		// 
		// Now process STATE_OUTSIDE_TAGS
		//
		
		// Check for start of HTML tag, and switch to STATE_IN_HTML_TAG if it is
		if ( ch == '<' )
		{
			state = STATE_IN_HTML_TAG;
			goto tokenize_buf;
		}
		
		// Check for start of HTML entity
		if ( ch == '&' )
		{
			state = STATE_IN_HTML_ENTITY;
			parseentity = QString::null;
			continue;
		}
		
		// Replace quote by ' - quotes are used in search window to set the phrase
		if ( ch == '"' )
			ch = '\'';
		
		// Ok, we have a valid character outside HTML tags, and probably some in buffer already.
		// If it is char or letter, add it and continue
		if ( ch.isLetterOrNumber() || m_charsword.indexOf( ch ) != -1 )
		{
			parsedbuf.append( ch );
			continue;
		}
		
		// If it is a split char, add the word to the dictionary, and then add the char itself.
		if ( m_charssplit.indexOf( ch ) != -1 )
		{
			if ( !parsedbuf.isEmpty() )
				tokenlist.push_back( parsedbuf.toLower() );
			
			tokenlist.push_back( ch.toLower() );
			parsedbuf = QString::null;
			continue;
		}
		
tokenize_buf:		
		// Just add the word; it is most likely a space or terminated by tokenizer.
		if ( !parsedbuf.isEmpty() )
		{
			tokenlist.push_back( parsedbuf.toLower() );
			parsedbuf = QString::null;
		}
	}
	
	// Add the last word if still here - for broken htmls.
	if ( !parsedbuf.isEmpty() )
		tokenlist.push_back( parsedbuf.toLower() );
	
	return true;
}
开发者ID:EmbolismSoil,项目名称:kchmviewer,代码行数:101,代码来源:helper_search_index.cpp

示例10: validateMathInLine

int MathInLine::validateMathInLine(NineMLLayout* component, QStringList * errs)
{
    // remove operators

    if (equation.size() == 0) {
        return 1;
    }

    QString test = equation;

    test = equation;
    test.replace('+', ' ');
    test = test.replace('-', ' ');
    test = test.replace('*', ' ');
    test = test.replace('/', ' ');
    test = test.replace('(', ' ');
    test = test.replace(')', ' ');
    test = test.replace('<', ' ');
    test = test.replace('>', ' ');
    test = test.replace('=', ' ');
    test = test.replace(',', ' ');

    QStringList FuncList;
    FuncList.push_back("pow");
    FuncList.push_back("exp");
    FuncList.push_back("sin");
    FuncList.push_back("cos");
    FuncList.push_back("log");
    FuncList.push_back("log10");
    FuncList.push_back("sinh");
    FuncList.push_back("cosh");
    FuncList.push_back("tanh");
    FuncList.push_back("sqrt");
    FuncList.push_back("atan");
    FuncList.push_back("asin");
    FuncList.push_back("acos");
    FuncList.push_back("asinh");
    FuncList.push_back("acosh");
    FuncList.push_back("atanh");
    FuncList.push_back("atan2");
    FuncList.push_back("ceil");
    FuncList.push_back("floor");
    FuncList.push_back("rand");
    FuncList.push_back("mod");


    // not strictly functions...
    FuncList.push_back("t");
    FuncList.push_back("dt");

    // remove double whitespaces
    test = test.simplified();

    // tokenise
    QStringList splitTest;
    splitTest = test.split(' ');

    // check each token...
    for (unsigned int i = 0; i < (uint) splitTest.count(); ++i) {

        bool recognised = false;

        // see if it is in the component
        for (unsigned int j = 0; j<component->ParameterList.size(); j++) {
            if (component->ParameterList[j]->name.compare(splitTest[i]) == 0)
                recognised = true;
        }
        for (unsigned int j = 0; j<component->StateVariableList.size(); j++) {
            if (component->StateVariableList[j]->name.compare(splitTest[i]) == 0)
                recognised = true;
        }
        for (unsigned int j = 0; j<component->AliasList.size(); j++) {
            if (component->AliasList[j]->name.compare(splitTest[i]) == 0)
                recognised = true;
        }
        for (unsigned int j = 0; j<(uint)FuncList.size(); j++) {
            if (FuncList[j].compare(splitTest[i]) == 0)
                recognised = true;
        }
        // see if it is a number...
        if (splitTest[i][0] > 47 && splitTest[i][0] < 58 && splitTest[i][0] != '.') {
            recognised = true;
        }

        // if a token is not recognised, then let the user know - this may be better done elsewhere...
        if (!recognised) {
            errs->push_back("MathString contains unrecognised token " + splitTest[i]);

        }

    }
    if (equation.count("(") != equation.count(")")) {
        errs->push_back("MathString contains mis-matched brackets");
    }

    return 0;
}
开发者ID:MuriloDAG,项目名称:SpineCreator,代码行数:97,代码来源:nineml_layout_classes.cpp

示例11: callDialog

mass* massDialog::callDialog(modeler *md)
{
	QList<QString> geoList = md->objects().keys();
	QStringList geoStrList;
	for (unsigned int i = 0; i < geoList.size(); i++){
		geoStrList.push_back(geoList[i]);
	}
	QComboBox *CBBase = new QComboBox;
	CBBase->addItems(geoStrList);
	QLabel *LCBBase = new QLabel("Base geometry");
	QLabel *LMass, *LIxx, *LIyy, *LIzz, *LIxy, *LIxz, *LIzy;
	QLineEdit *LEMass, *LEIxx, *LEIyy, *LEIzz, *LEIxy, *LEIxz, *LEIzy;
	
	LMass = new QLabel("Mass"); LEMass = new QLineEdit;
	LIxx = new QLabel("Ixx");	LEIxx = new QLineEdit;
	LIyy = new QLabel("Iyy");   LEIyy = new QLineEdit;
	LIzz = new QLabel("Izz");	LEIzz = new QLineEdit;
	LIxy = new QLabel("Ixy");	LEIxy = new QLineEdit;
	LIxz = new QLabel("Ixz");	LEIxz = new QLineEdit;
	LIzy = new QLabel("Izy");	LEIzy = new QLineEdit;
	
	PBOk = new QPushButton("OK");
	PBCancel = new QPushButton("Cancel");
	connect(PBOk, SIGNAL(clicked()), this, SLOT(Click_ok()));
	connect(PBCancel, SIGNAL(clicked()), this, SLOT(Click_cancel()));
	QGridLayout *massLayout = new QGridLayout;
	massLayout->addWidget(LCBBase, 0, 0);
	massLayout->addWidget(CBBase, 0, 1, 1, 2);
	massLayout->addWidget(LMass, 1, 0);
	massLayout->addWidget(LEMass, 1, 1, 1, 2);
	massLayout->addWidget(LIxx, 2, 0);
	massLayout->addWidget(LEIxx, 2, 1, 1, 1);
	massLayout->addWidget(LIxy, 3, 0);
	massLayout->addWidget(LEIxy, 3, 1, 1, 1);
	massLayout->addWidget(LIyy, 3, 2);
	massLayout->addWidget(LEIyy, 3, 3, 1, 1);
	massLayout->addWidget(LIxz, 4, 0);
	massLayout->addWidget(LEIxz, 4, 1, 1, 1);
	massLayout->addWidget(LIzy, 4, 2);
	massLayout->addWidget(LEIzy, 4, 3, 1, 1);
	massLayout->addWidget(LIzz, 4, 4);
	massLayout->addWidget(LEIzz, 4, 5, 1, 1);
	massLayout->addWidget(PBOk, 5, 4);
	massLayout->addWidget(PBCancel, 5, 5);
	this->setLayout(massLayout);
	this->exec();
	mass* m = NULL;
	if (isDialogOk)
	{
		m = md->makeMass(CBBase->currentText());
		m->setMass(LEMass->text().toFloat());		
		
		VEC3D syminer;							//inertia
		syminer.x = LEIxy->text().toFloat();
		syminer.y = LEIxz->text().toFloat();
		syminer.z = LEIzy->text().toFloat();
		m->setSymIner(syminer);

		VEC3D prininer;
		prininer.x = LEIxx->text().toFloat();
		prininer.y = LEIyy->text().toFloat();
		prininer.z = LEIzz->text().toFloat();
		m->setPrinIner(prininer);
		m->setInertia();//m->define();
	}
	return m;
}
开发者ID:metakonga,项目名称:kangsia,代码行数:67,代码来源:massDialog.cpp

示例12: main

int main(int argc, char **argv)
{
    MyScopedSyslogListener syslogListener;

    //did the user specified files on the command line?
    //stash the files so they are loaded into the editor
    //this replaces the currently stored file list
    QStringList files;
    for (int i = 1; i < argc; i++)
    {
        QString file(argv[i]);
        if (file.isEmpty()) continue;
        files.push_back(file);
    }
    if (not files.isEmpty()) getSettings().setValue("GraphEditorTabs/files", files);

    //create the entry point to the GUI
    QApplication app(argc, argv);
    app.setOrganizationName("PothosWare");
    app.setApplicationName("Pothos");

    //create splash screen
    getSplashScreen()->show();

    //setup the application icon
    app.setWindowIcon(QIcon(makeIconPath("PothosGui.png")));

    //perform library initialization with graphical error message on failure
    Pothos::RemoteServer server;
    try
    {
        //try to talk to the server on localhost, if not there, spawn a custom one
        //make a server and node that is temporary with this process
        postStatusMessage("Launching scratch process...");
        try
        {
            Pothos::RemoteClient client("tcp://"+Pothos::Util::getLoopbackAddr());
        }
        catch (const Pothos::RemoteClientError &)
        {
            server = Pothos::RemoteServer("tcp://"+Pothos::Util::getLoopbackAddr(Pothos::RemoteServer::getLocatorPort()));
            //TODO make server background so it does not close with process
            Pothos::RemoteClient client("tcp://"+Pothos::Util::getLoopbackAddr()); //now it should connect to the new server
        }
    }
    catch (const Pothos::Exception &ex)
    {
        QMessageBox msgBox(QMessageBox::Critical, "Pothos Initialization Error", QString::fromStdString(ex.displayText()));
        msgBox.exec();
        return EXIT_FAILURE;
    }

    POTHOS_EXCEPTION_TRY
    {
        postStatusMessage("Initializing Pothos plugins...");
        Pothos::ScopedInit init;

        //create the main window for the GUI
        std::unique_ptr<QWidget> mainWindow(new PothosGuiMainWindow(nullptr));
        mainWindow->show();
        getSplashScreen()->finish(mainWindow.get());
        getSettings().setParent(mainWindow.get());

        //begin application execution
        return app.exec();
    }
    POTHOS_EXCEPTION_CATCH (const Pothos::Exception &ex)
    {
        QMessageBox msgBox(QMessageBox::Critical, "PothosGui Application Error", QString::fromStdString(ex.displayText()));
        msgBox.exec();
        return EXIT_FAILURE;
    }
开发者ID:xloem,项目名称:pothos,代码行数:72,代码来源:PothosGui.cpp

示例13: updateFilter

void ContactsInner::updateFilter(QString filter) {
	QStringList f;
	if (!filter.isEmpty()) {
		QStringList filterList = filter.split(cWordSplit(), QString::SkipEmptyParts);
		int l = filterList.size();

		f.reserve(l);
		for (int i = 0; i < l; ++i) {
			QString filterName = filterList[i].trimmed();
			if (filterName.isEmpty()) continue;
			f.push_back(filterName);
		}
		filter = f.join(' ');
	}
	if (_filter != filter) {
		int32 rh = (st::profileListPhotoSize + st::profileListPadding.height() * 2);
		_filter = filter;
		if (_filter.isEmpty()) {
			resize(width(), _contacts->list.count * rh + st::contactsClose.height);
			if (_contacts->list.count) {
				_sel = _contacts->list.begin;
			}
		} else {
			QStringList::const_iterator fb = f.cbegin(), fe = f.cend(), fi;

			_filtered.clear();
			if (!f.isEmpty()) {
				DialogsList *dialogsToFilter = 0;
				if (_contacts->list.count) {
					for (fi = fb; fi != fe; ++fi) {
						DialogsIndexed::DialogsIndex::iterator i = _contacts->index.find(fi->at(0));
						if (i == _contacts->index.cend()) {
							dialogsToFilter = 0;
							break;
						}
						if (!dialogsToFilter || dialogsToFilter->count > i.value()->count) {
							dialogsToFilter = i.value();
						}
					}
				}
				if (dialogsToFilter && dialogsToFilter->count) {
					_filtered.reserve(dialogsToFilter->count);
					for (DialogRow *i = dialogsToFilter->begin, *e = dialogsToFilter->end; i != e; i = i->next) {
						const PeerData::Names &names(i->history->peer->names);
						PeerData::Names::const_iterator nb = names.cbegin(), ne = names.cend(), ni;
						for (fi = fb; fi != fe; ++fi) {
							QString filterName(*fi);
							for (ni = nb; ni != ne; ++ni) {
								if ((*ni).indexOf(*fi) == 0) {
									break;
								}
							}
							if (ni == ne) {
								break;
							}
						}
						if (fi == fe) {
							i->attached = 0;
							_filtered.push_back(i);
						}
					}
				}
			}
			_filteredSel = _filtered.isEmpty() ? -1 : 0;

			resize(width(), _filtered.size() * rh + st::contactsClose.height);
		}
		if (parentWidget()) parentWidget()->update();
		loadProfilePhotos(0);
	}
}
开发者ID:bertothunder,项目名称:tdesktop,代码行数:71,代码来源:contactsbox.cpp

示例14: file

template <typename M> void MatchT<M>::split()
{
    if(!ShapeT<M>::isMeshOpen() || parts_.size()==0 || points_.size()==0)
    {
        qCritical() << "Cannot split mesh! Either mesh is not open or parts or points do not exist!" ;
        return;
    }
    
    // Try to find a seg file to use for splitting the mesh
    bool useSegFile = false;
    
    QStringList pathParts = meshFilename_.split("/");
    
    QString segName = pathParts.last().split(".").first().append(".seg");
    
    pathParts.removeLast();
    
    pathParts.push_back(segName);
    
    QString segPath = pathParts.join("/");
    
    QFile file(segPath);
    
    std::vector<int> segLabels;
    
    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        qCritical() << "Could not open file " << segPath ;
    }
    else
    {
        QTextStream in(&file);
        
        while (!in.atEnd())
        {
            QString line = in.readLine();
            segLabels.push_back(line.toInt());
        }
        
        if (segLabels.size()!= ShapeT<M>::mesh_.n_faces())
        {
            qDebug() << "Mesh has a seg file, but it only contained " << segLabels.size() << " labels for " << ShapeT<M>::mesh_.n_faces() << " faces, so cannot use it!";
        }
        else
        {
            useSegFile = true;
        }
    }
    
    std::map<int, int> partID2partIndex;
    
    std::map<int, std::map<typename M::VertexHandle,typename M::VertexHandle> > partID2vhMap;
    
    typename std::vector<Part>::const_iterator partscIt (parts_.begin()), partscEnd(parts_.end());

    int index =0;
    
    for (; partscIt != partscEnd; ++partscIt)
    {
        partID2partIndex[partscIt->partID_] = index;
        index++;
    }

    
    typename M::ConstFaceIter cfIt(ShapeT<M>::mesh_.faces_begin()), facesEnd(ShapeT<M>::mesh_.faces_end());
    
    int f = 0;
    
    // For every face go over all points of the match and find the nearest point to this face
    for (; cfIt!=facesEnd; ++cfIt)
    {
        int facePartID = -1;
        
        // Get the three vertices of this face (should be 3) so we can get the normal to the face
        typename M::ConstFaceVertexIter cfvIt;
        
        if (useSegFile)
        {
            facePartID = segLabels[ShapeT<M>::indexMap_[f]] + 1; //only works assuming part ids start from 2 and seg ids start from 1
        }
        else
        {
            cfvIt= ShapeT<M>::mesh_.cfv_iter(cfIt);
            
            typename std::vector<MeshPoint>::const_iterator pointsIt(points_.begin()), pointsEnd(points_.end());
            
            double minDistance = std::numeric_limits<double>::max();
          
            typename M::Point p0 = ShapeT<M>::mesh_.point(cfvIt);
            ++cfvIt;
            typename M::Point p1 = ShapeT<M>::mesh_.point(cfvIt);
            ++cfvIt;
            typename M::Point p2 = ShapeT<M>::mesh_.point(cfvIt);
            
            // Go over all points in the match (these have part id labels)
            for( ; pointsIt!=pointsEnd ; ++pointsIt)
            {
                double p2pDistance = sqrDistPoint2Triangle(p0,p1,p2,OpenMesh::vector_cast<typename M::Point>(pointsIt->pos_));
                
                if (p2pDistance < minDistance)
//.........这里部分代码省略.........
开发者ID:vladfi1,项目名称:ShapeSynth,代码行数:101,代码来源:MatchT.cpp

示例15: stringList

 static QStringList stringList( const char * headers[], int numHeaders ) {
   QStringList sl;
   for ( int i = 0 ; i < numHeaders ; ++i )
     sl.push_back( headers[i] );
   return sl;
 }
开发者ID:,项目名称:,代码行数:6,代码来源:


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