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


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

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


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

示例1:

void
QGAppTracker::startApp(const QString& cmdline, bool waitEnd) 
{
  // Ensure that the process is runnable.
  if (_state != READY)
    return;


  QStringList list = cmdline.split(" ");

  _process->start(list.takeFirst(), list, QIODevice::ReadWrite);
  _process->waitForStarted();

  if(_process->state() == QProcess::NotRunning) 
  {
    _state = UNRUNNABLE;
    _process->kill();
  
    _obs->startError();
  }
  
  else {
    _state = RUNNING;
    _obs->start();
   
    // Block the application until the process is finished
    if (waitEnd)
    {
      _process->waitForFinished(-1);
    }
  }
}
开发者ID:rentpath,项目名称:qgar,代码行数:32,代码来源:QGAppTracker.cpp

示例2: parseSyntax

IrcCommandInfo IrcCommandParserPrivate::parseSyntax(IrcCommand::Type type, const QString& syntax)
{
    IrcCommandInfo cmd;
    QStringList tokens = syntax.split(QLatin1Char(' '), QString::SkipEmptyParts);
    if (!tokens.isEmpty()) {
        cmd.type = type;
        cmd.command = tokens.takeFirst().toUpper();
        cmd.syntax = tokens.join(QLatin1String(" "));
        cmd.max = tokens.count();

        IrcParameterInfo param;
        for (int i = 0; i < tokens.count(); ++i) {
            const QString& token = tokens.at(i);
            param.optional = isOptional(token);
            param.channel = isChannel(token);
            param.current = isCurrent(token);
            param.multi = isMultiWord(token);
            if (!param.optional)
                ++cmd.min;
            if (param.optional && param.channel)
                ++cmd.min;
            const bool last = (i == tokens.count() - 1);
            if (last && param.multi)
                cmd.max = INT_MAX;
            cmd.params += param;
        }
    }
    return cmd;
}
开发者ID:Mudlet,项目名称:Mudlet,代码行数:29,代码来源:irccommandparser.cpp

示例3: QString

QString qucs2spice::convert_diode(QString line,bool xyce)
{
    QString s="";
    QStringList lst = line.split(" ",QString::SkipEmptyParts);
    QString name = lst.takeFirst();
    int idx = name.indexOf(':');
    name =  name.right(name.count()-idx-1); // name
    QString K = lst.takeFirst();
    QString A = lst.takeFirst();
    s += QString("D%1 %2 %3 DMOD_%4 \n").arg(name).arg(A).arg(K).arg(name);
    QString mod_params = lst.join(" ");
    mod_params.remove('\"');
    if (xyce) s += QString(".MODEL DMOD_%1 D(LEVEL=2 %2) \n").arg(name).arg(mod_params);
    else  s += QString(".MODEL DMOD_%1 D(%2) \n").arg(name).arg(mod_params);
    return s;
}
开发者ID:nvdl,项目名称:qucs,代码行数:16,代码来源:qucs2spice.cpp

示例4: init_buff

void Countries::init_buff()
{
    if( p->inited )
        return;

    QFile file(FILE_PATH);
    if( !file.open(QFile::ReadOnly) )
        return;

    QString data = file.readAll();
    QStringList splits = data.split("\n",QString::SkipEmptyParts);
    if( splits.isEmpty() )
        return;

    QStringList heads = splits.takeFirst().split(";",QString::SkipEmptyParts);

    foreach( const QString & s, splits )
    {
        const QStringList & parts = s.split(";",QString::SkipEmptyParts);
        for( int i=0; i<parts.count(); i++ )
        {
            const QString & prt = parts.at(i);
            p->data[parts.first()][heads.at(i)] = prt;
        }
    }

    p->inited = true;
}
开发者ID:atilacamurca,项目名称:sigram,代码行数:28,代码来源:countries.cpp

示例5: findObject

QModelIndex QDBusModel::findObject(const QDBusObjectPath &objectPath)
{
    QStringList path = objectPath.path().split(QLatin1Char('/'), QString::SkipEmptyParts);

    QDBusItem *item = root;
    int childIdx = -1;
    while (item && !path.isEmpty()) {
        const QString branch = path.takeFirst() + QLatin1Char('/');
        childIdx = -1;

        // do a linear search over all the children
        for (int i = 0; i < item->children.count(); ++i) {
            QDBusItem *child = item->children.at(i);
            if (child->type == PathItem && child->name == branch) {
                item = child;
                childIdx = i;

                // prefetch the found branch
                if (!item->isPrefetched)
                    addPath(item);
                break;
            }
        }

        // branch not found - bail out
        if (childIdx == -1)
            return QModelIndex();
    }

    // found the right item
    if (childIdx != -1 && item && path.isEmpty())
        return createIndex(childIdx, 0, item);

    return QModelIndex();
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:35,代码来源:qdbusmodel.cpp

示例6: initResPlugins

void initResPlugins()
{
    static ResPlugin *array[128];
    resplugins = array;
#ifdef Q_OS_WIN
    QDir pluginsDir = QDir(Settings::path);
    pluginsDir.cd("plugins");
    QStringList list = pluginsDir.entryList(QDir::Files, QDir::Name);
#else
    QDir pluginsDir = QDir("/usr/share/moonplayer/plugins");
    QStringList list = pluginsDir.entryList(QDir::Files, QDir::Name);
    pluginsDir = QDir::home();
    pluginsDir.cd(".moonplayer");
    pluginsDir.cd("plugins");
    list += pluginsDir.entryList(QDir::Files, QDir::Name);
#endif
    while (!list.isEmpty())
    {
        QString filename = list.takeFirst();
        if (filename.startsWith("res_") && filename.endsWith(".py"))
        {
            array[n_resplugins] = new ResPlugin(filename.section('.', 0, 0));
            n_resplugins++;
        }
    }
}
开发者ID:lipq525,项目名称:moonplayer,代码行数:26,代码来源:resplugin.cpp

示例7: loadScriptEngine

void ScriptablePrivate::loadScriptEngine()
{
  if(_scriptLoaded || !_parent)
    return;
  _scriptLoaded = true;

  QStringList scriptList;

  // load scripts by class heirarchy name
  const QMetaObject *m = _parent->metaObject();
  while(m)
  {
    scriptList.prepend(m->className());
    m = m->superClass();
  }

  // load scripts by object name
  QStringList parts = _parent->objectName().split(" ");
  QStringList search_parts;
  QString oName;
  while(!parts.isEmpty())
  {
    search_parts.append(parts.takeFirst());
    oName = search_parts.join(" ");
    scriptList.append(oName);
  }

  scriptList.removeDuplicates();
  for (int i = 0; i < scriptList.size(); ++i)
    loadScript(scriptList.at(i));
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:31,代码来源:scriptablePrivate.cpp

示例8: readStdout

void OcaOctaveController::readStdout()
{
  char buf[ 1024 ];
  //fprintf( stderr, "OcaOctaveController::readStdout $$$ %d (%d)\n", result, m_pipeFd );
  int result = -1;
  do {
    result = read( m_pipeFd, buf, 1023 );
    if( 0 < result ) {
      //fprintf( stderr, "OcaOctaveController::readStdout\n" );
      //fwrite( buf, 1, result, stderr );
      //fprintf( stderr, "OcaOctaveController::readStdout - END\n" );
      buf[ result ] = 0;

      m_stdoutBuf += QString::fromLocal8Bit( buf );
      QStringList lines = m_stdoutBuf.split( '\n' );
      m_stdoutBuf = lines.takeLast();
      //Q_ASSERT( ! lines.isEmpty() );
      /*
      if( '\n' != m_stdoutBuf[ m_stdoutBuf.length() - 1 ] ) {
        m_stdoutBuf = lines.takeLast();
      }
      else {
        m_stdoutBuf.clear();
        QString s = lines.takeLast();
        Q_ASSERT( s.isEmpty() );
      }
      */
      while( ! lines.isEmpty() ) {
        QString s = lines.takeFirst();
        //fprintf( stderr, "readStdout: %s\n", s.toLocal8Bit().data() );
        emit outputReceived( s, 0 );
      }
    }
  } while( ( 1023 == result ) && ( e_StateReady == m_state ) );
}
开发者ID:antonrunov,项目名称:octaudio,代码行数:35,代码来源:OcaOctaveController.cpp

示例9: slotConnectionEstablished

/**
 * @brief Executed when new instance connect command is sent to LocalServer
 */
void Rshare::slotConnectionEstablished()
{
	QLocalSocket *socket = localServer->nextPendingConnection();
	socket->close();
	delete socket;

	QSharedMemory newArgs;
	newArgs.setKey(QString(TARGET) + "_newArgs");

	if (!newArgs.attach())
	{
		std::cerr << "(EE) Rshare::slotConnectionEstablished() Unable to attach to shared memory segment."
		          << newArgs.errorString().toStdString() << std::endl;
		return;
	}

	QBuffer buffer;
	QDataStream in(&buffer);
	QStringList args;

	newArgs.lock();
	buffer.setData((char*)newArgs.constData(), newArgs.size());
	buffer.open(QBuffer::ReadOnly);
	in >> args;
	newArgs.unlock();
	newArgs.detach();

	emit newArgsReceived(args);
	while (!args.empty())
	{
		std::cerr << "Rshare::slotConnectionEstablished args:" << QString(args.takeFirst()).toStdString() << std::endl;
	}
}
开发者ID:jiangxilong,项目名称:RetroShare,代码行数:36,代码来源:rshare.cpp

示例10: on_actionRole_assign_table_triggered

void MainWindow::on_actionRole_assign_table_triggered()
{
    QString content;

    QStringList headers;
    headers << tr("Count") << tr("Lord") << tr("Loyalist") << tr("Rebel") << tr("Renegade");
    foreach(QString header, headers)
        content += QString("<th>%1</th>").arg(header);

    content = QString("<tr>%1</tr>").arg(content);

    QStringList rows;
    rows << "2 1 0 1 0" << "3 1 0 1 1" << "4 1 0 2 1"
            << "5 1 1 2 1" << "6 1 1 3 1" << "6d 1 1 2 2"
            << "7 1 2 3 1" << "8 1 2 4 1" << "8d 1 2 3 2"
            << "9 1 3 4 1" << "10 1 3 4 2";

    foreach(QString row, rows){
        QStringList cells = row.split(" ");
        QString header = cells.takeFirst();
        if(header.endsWith("d")){
            header.chop(1);
            header += tr(" (double renegade)");
        }

        QString row_content;
        row_content = QString("<td>%1</td>").arg(header);
        foreach(QString cell, cells){
            row_content += QString("<td>%1</td>").arg(cell);
        }
开发者ID:coldera,项目名称:Qmelee,代码行数:30,代码来源:mainwindow.cpp

示例11: taskify

void QuickTask::taskify(){
    QString text=this->editor.toPlainText();
    QRegExp rx("((\n|^)?\\s*[\\*-].+(\n[-\\*]?|$))");
    rx.setMinimal(true);

    QStringList list;
    int pos = 0;

    while ((pos = rx.indexIn(text, pos)) != -1) {
       QString string =rx.cap(1);
        list << string;
        qDebug()<< string;
        //if we have 2 task, seperate them!

        if(list.length()>1){

            QTextEdit *edit=new QTextEdit(this);
            edit->setText(list.takeFirst());
            //this->editor.setText(text.mid(pos));
            //this->layout.removeWidget(&this->editor);
            //this->layout.addWidget(edit);
            //this->layout.addWidget(&this->editor);
            this->editor.moveCursor(QTextCursor::End);

        }


        pos += rx.matchedLength();
        if(text.at(pos-1)=='-' || text.at(pos-1)=='*')pos--;
    }


}
开发者ID:martamius,项目名称:mushi,代码行数:33,代码来源:quicktask.cpp

示例12: uriFor

QUrl Context::uriFor(Action *action, const QStringList &captures, const QStringList &args, const ParamsMultiMap &queryValues) const
{
    Q_D(const Context);

    QUrl uri;
    Action *localAction = action;
    if (!localAction) {
        localAction = d->action;
    }

    QStringList localArgs = args;
    QStringList localCaptures = captures;

    Action *expandedAction = d->dispatcher->expandAction(this, action);
    if (expandedAction->numberOfCaptures() > 0) {
        while (localCaptures.size() < expandedAction->numberOfCaptures()
               && localArgs.size()) {
            localCaptures.append(localArgs.takeFirst());
        }
    } else {
        QStringList localCapturesAux = localCaptures;
        localCapturesAux.append(localArgs);
        localArgs = localCapturesAux;
        localCaptures = QStringList();
    }

    const QString path = d->dispatcher->uriForAction(localAction, localCaptures);
    if (path.isEmpty()) {
        qCWarning(CUTELYST_CORE) << "Can not find action for" << localAction << localCaptures;
        return uri;
    }

    uri = uriFor(path, localArgs, queryValues);
    return uri;
}
开发者ID:cutelyst,项目名称:cutelyst,代码行数:35,代码来源:context.cpp

示例13: requestfromini

QNetworkRequest inihandlerclass::requestfromini(const QString &inistring) {
	QFile f;
	f.setFileName(QApplication::applicationDirPath() + QDir::separator()
			+ "snpini" + QDir::separator() + file);
	if (!f.open(QIODevice::ReadOnly)) {
		qDebug() << "snpini/netini is missing!";
	}
	QTextStream ts(&f);
	while (ts.readLine() != inistring && !ts.atEnd())
		;
	if (ts.atEnd()) {
		qDebug() << "your netini file is corrupt! " << inistring
				<< " can not be found, but is important.";
	}

	QNetworkRequest r;
	QStringList sl;
	QString s(ts.readLine());
	while (!s.startsWith("[") && !ts.atEnd()) {
		if(!s.startsWith("//") && s!=""){
			sl = s.split(" ");
			QString s1=sl.takeFirst();
			QString s2=sl.join(" ");
                        r.setRawHeader(s1.toAscii(), s2.toAscii());
		}
		s = ts.readLine();
	}
	return r;
}
开发者ID:svn2github,项目名称:twsoldunsupported,代码行数:29,代码来源:inihandlerclass.cpp

示例14: message

void ChatClient::message(const QStringList &args)
{
    if (m_conn->status() != QtJsonDb::QJsonDbConnection::Connected) {
        fprintf(stderr, "Not connected to JSONDB\n");
        return;
    }

    QStringList messageArgs = args;
    QtJsonDb::QJsonDbObject message;
    message.insert(QLatin1String("_type"), QLatin1String("ChatMessage"));
    message.insert(QLatin1String("from"), m_username);
    message.insert(QLatin1String("to"), messageArgs.takeFirst());
    if (message.value(QLatin1String("from")) == message.value(QLatin1String("to"))) {
        fprintf(stderr, "Talking to oneself is not supported\n");
        return;
    }
    message.insert(QLatin1String("message"), messageArgs.join(QLatin1String(" ")));
    message.insert(QLatin1String("time"), QDateTime::currentDateTime().toString("ddMMyyyy hh:mm:ss"));

    QtJsonDb::QJsonDbWriteRequest *request = new QtJsonDb::QJsonDbCreateRequest(message, this);
    connect(request, SIGNAL(finished()), request, SLOT(deleteLater()));
    connect(request, SIGNAL(error(QtJsonDb::QJsonDbRequest::ErrorCode,QString)),
            this, SLOT(error(QtJsonDb::QJsonDbRequest::ErrorCode,QString)));
    m_conn->send(request);
}
开发者ID:Distrotech,项目名称:qtjsondb,代码行数:25,代码来源:chatclient.cpp

示例15: run

void LibFritzInit::run() {

	emit ready(false);

	bool locationSettingsDetected;
	std::string countryCode = KSettings::countryCode().toStdString();
	std::string areaCode = KSettings::areaCode().toStdString();
	KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

	if (args->isSet("log-personal-info")) {
		INF("Warning: Logging personal information requested!")
	}
	// start libfritz++
    fritz::Config::Setup(KSettings::hostname().toStdString(), username.toStdString(), password.toStdString(), args->isSet("log-personal-info"));

	fritz::Config::SetupConfigDir(KStandardDirs::locateLocal("data", KGlobal::mainComponent().aboutData()->appName()+'/').toStdString());

	std::vector<std::string> vFonbook;
	QStringList phonebookList = KSettings::phonebookList();
	while (phonebookList.count())
		vFonbook.push_back(phonebookList.takeFirst().toStdString());
	fritz::FonbookManager::CreateFonbookManager(vFonbook, "", false);

	bool validPassword = fritz::Config::Init(&locationSettingsDetected, &countryCode, &areaCode);
	if (!validPassword) {
		emit invalidPassword();
		return;
	}

	if (locationSettingsDetected) {
		KSettings::setCountryCode(QString(countryCode.c_str()));
		KSettings::setAreaCode(QString(areaCode.c_str()));
		KSettings::self()->writeConfig();
	}

	std::vector<std::string> vMsn;
	QStringList msnList = KSettings::mSNFilter();
	while (msnList.count())
		vMsn.push_back(msnList.takeFirst().toStdString());
	fritz::Config::SetupMsnFilter(vMsn);

	fritz::Listener::CreateListener(eventHandler);

	fritz::CallList::CreateCallList();

	emit ready(true);
}
开发者ID:KDE,项目名称:kfritz,代码行数:47,代码来源:LibFritzInit.cpp


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