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


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

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


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

示例1:

void
wCatalogEditor::checkUserFields( QStringList &lst)
{
	aCfgItem item = md->find(catId);
	int fid;
	if(item.isNull()) return;
	item = md->findChild(item,md_element);
	for(int i=0; i< md->count(item,md_field); i++)
  	{
		aCfgItem mdi = md->findChild(item,md_field,i);
		int ind = lst.findIndex(QString("uf%1").arg(md->attr(mdi,mda_id)));
		if(ind!=-1)
		{
			lst.insert(lst.at(i),lst[ind]);
			lst.remove(lst.at(ind+1));
			
		}
		else
		{
			ind = lst.findIndex(QString("text_uf%1").arg(md->attr(mdi,mda_id)));
			if(ind!=-1)
			{
				lst.insert(lst.at(i),lst[ind]);
				lst.remove(lst.at(ind+1));
			
			}
		}
  	}
	
}
开发者ID:app,项目名称:ananas-labs,代码行数:30,代码来源:wcatalogeditor.cpp

示例2: help

int help(QStringList commands) {
    //qDebug() << "help(" << commands.join(" ") << ")" << endl;

    /**
     * Check input
     */
    if(commands.size() < 2 ) {

        errorStream << "Error: help(" << commands.join(" ") << ") has not enough parameters (help cmd ...)" << endl;
        return 1;
    }

    if(commands.at(0)!="help") {

        errorStream << "Error: help(" << commands.join(" ") << ") is no valid call (help cmd ...)" << endl;
        return 1;
    }

    commands.pop_front();
    commands.insert(0, "usage");

    usage(commands);

    commands.pop_front();
    commands.insert(0, "description");

    description(commands);

    return 0;
}
开发者ID:stefanhans,项目名称:ContextRouting,代码行数:30,代码来源:usage.cpp

示例3: parseIngredient

QStringList NFCHandler::parseIngredient(QString ing){
	QStringList list;
	QStringList result;
	list = ing.split(")", QString::SkipEmptyParts);

	for(int i=0; i<list.length(); i++){
			QStringList looplist;
			looplist = list.at(i).split(",", QString::SkipEmptyParts);

			// Get rid of leading (
			QString type = looplist.at(0);
			type = type.remove(QChar('('), Qt::CaseInsensitive).trimmed();


			if(type.toStdString() == "name"){

				result.insert(0, looplist.at(1).trimmed());

			} else if(type.toStdString() == "amount"){
				result.insert(1,looplist.at(1).trimmed());

			}

		}

	return result;

}
开发者ID:vallism2000,项目名称:Test,代码行数:28,代码来源:NFCHandler.cpp

示例4: ADD_CHILD_ITEM

void TREE_SECIM_KERNEL::ADD_CHILD_ITEM (QStringList column_datas,int number_of_child, bool select_item_if_multi_row_enable)
{
    bool item_is_selected = false;

    if (m_is_multi_row EQ true) {
        if (select_item_if_multi_row_enable EQ false) {
            column_datas.insert   (0 , QString("ADD_CHECK_BOX"));
            column_datas       <<      QString("ADD_CHECK_BOX");
        }
        else {
            column_datas.insert   (0 , QString("ADD_SELECTED_CHECK_BOX"));
            column_datas            << QString("ADD_SELECTED_CHECK_BOX");
            item_is_selected       = true;
        }
    }

    BASE_TREE_KERNEL::ADD_CHILD_ITEM(column_datas,number_of_child);

    if (item_is_selected EQ true) {
        QTreeWidgetItem * item = GET_LAST_ADDED_ITEM();
        if ( item NE NULL ) {
            m_selected_items << item;
        }
    }
}
开发者ID:coolixwebgraphics,项目名称:FRAMEWORK,代码行数:25,代码来源:tree_secim_kernel.cpp

示例5: saveAndAccept

void ConnectionDialog::saveAndAccept ()
{
	if (serverEdit->currentText ().isEmpty ()
		|| roomEdit->currentText ().isEmpty ()
		|| nickEdit->currentText ().isEmpty ()) {

		QMessageBox::critical (this, "", tr ("Parameters is not valid"));
		return;
	}

	fSettings settings;
	if (serverEdit->findText (serverEdit->currentText (), Qt::MatchFixedString) == -1) {
		QStringList l = settings.value("Connection/Servers", QStringList ()).toStringList ();
		l.insert(0, serverEdit->currentText ());
		settings.setValue("Connection/Servers", l);
	}
	if (roomEdit->findText (roomEdit->currentText (), Qt::MatchFixedString) == -1) {
		QStringList l = settings.value("Connection/Rooms_" + serverEdit->currentText (), QStringList ()).toStringList ();
		l.insert(0, roomEdit->currentText ());
		settings.setValue("Connection/Rooms_" + serverEdit->currentText (), l);
	}
	if (nickEdit->findText (nickEdit->currentText (), Qt::MatchFixedString) == -1) {
		QStringList l = settings.value("Connection/Nicks_" + serverEdit->currentText (), QStringList ()).toStringList ();
		l.insert(0, nickEdit->currentText ());
		settings.setValue("Connection/Nicks_" + serverEdit->currentText (), l);
	}

	settings.setValue("Connection/LastServer", serverEdit->currentIndex ());
	settings.setValue("Connection/LastRoom_" + serverEdit->currentText (), roomEdit->currentIndex ());
	settings.setValue("Connection/LastNick_" + serverEdit->currentText (), nickEdit->currentIndex ());

	accept ();
}
开发者ID:Apkawa,项目名称:leechcraft,代码行数:33,代码来源:connectiondialog.cpp

示例6: testOrdering

void Ut_MApplicationExtensionManager::testOrdering()
{
    MWidget extensionWidget1;
    setupGoodExtension(true, &extensionWidget1);
    gMDesktopEntryStub->stubSetReturnValue("fileName", QString(APPLICATION_EXTENSION_DATA_DIR) + "/test");
    QSharedPointer<const MApplicationExtensionMetaData> metaData(new MApplicationExtensionMetaData(""));

    // order with one entry
    QStringList order;
    order << "test";
    setupTestSubject(QString(), QString(), order);
    setupGoodExtension(true, &extensionWidget1);
    QCOMPARE(manager->instantiateInProcessExtension(metaData), true);
    verifyOrderCreatedInDataStore(0);

    // order with three entries
    order.insert(0, "test2");
    order.insert(1, "");
    setupTestSubject(QString(), QString(), order);
    setupGoodExtension(true, &extensionWidget1);
    QCOMPARE(manager->instantiateInProcessExtension(metaData), true);
    verifyOrderCreatedInDataStore(2);
    // check that unordered entry goes to correct place
    gMDesktopEntryStub->stubSetReturnValue("fileName", QString(APPLICATION_EXTENSION_DATA_DIR) + "/unordered");
    setupGoodExtension(true, &extensionWidget1);
    QCOMPARE(manager->instantiateInProcessExtension(metaData), true);
    verifyOrderCreatedInDataStore(1);
    // check the first entry
    gMDesktopEntryStub->stubSetReturnValue("fileName", QString(APPLICATION_EXTENSION_DATA_DIR) + "/test2");
    setupGoodExtension(true, &extensionWidget1);
    QCOMPARE(manager->instantiateInProcessExtension(metaData), true);
    verifyOrderCreatedInDataStore(0);
}
开发者ID:arcean,项目名称:libmeegotouch-framework,代码行数:33,代码来源:ut_mapplicationextensionmanager.cpp

示例7: alsactl

static bool alsactl(QStringList & args)
{
    if(usePulse) {
        QProcess p;
        args.insert(0, "alsactl");
        args.insert(0, "--");
        qLog(AudioState) << "pasuspender " << args;
        p.start("pasuspender", args);
        p.waitForFinished(-1);
        return true;
    }
    
    qLog(AudioState) << "alsactl " << args;

    for(int i = 0; i < 8; i++) {
        
        QProcess p;
        p.start("alsactl", args);
        p.waitForFinished(-1);
        QString output = p.readAllStandardOutput();
        output += p.readAllStandardError();

        if(output.length() == 0)
            return true;

        qWarning() << "alsactl returned " << output << ", running kill-snd-card-users.sh";
        QProcess::execute("kill-snd-card-users.sh");
    }
    return false;
}
开发者ID:pini-gh,项目名称:qtmoko,代码行数:30,代码来源:neoaudioplugin.cpp

示例8: rewriteMetadata

bool MQLUtil::rewriteMetadata(QString &query,      const QString &group,
                              const QString &name, const QString &notes)
{
  QStringList lines = query.split("\n");
  QString groupline;
  QString nameline;

  for (int i = 0; i < lines.size(); i++)
  {
    if (groupRE.indexIn(lines.at(i)) >= 0)
    {
      if (groupRE.cap(2).trimmed().compare(group.trimmed(), Qt::CaseInsensitive) == 0)
        groupline = lines.takeAt(i--);
      else
        lines.removeAt(i--);
    }
    else if (nameRE.indexIn(lines.at(i)) >= 0)
    {
      if (nameRE.cap(2).trimmed().compare(name.trimmed(), Qt::CaseInsensitive) == 0)
        nameline = lines.takeAt(i--);
      else
        lines.removeAt(i--);
    }
    else if (notesRE.indexIn(lines.at(i)) >= 0)
    {
      lines.removeAt(i--);
      while (dashdashRE.indexIn(lines.at(++i)) >= 0)
        lines.removeAt(i--);
    }
  }

  QStringList noteslines = notes.split("\n");
  if (noteslines.size() > 0)
  {
    if (! noteslines.at(0).contains(notesRE))
      noteslines.replace(0, "-- Notes: " + noteslines.at(0));

    for (int i = 1; i < noteslines.size(); i++)
      if (dashdashRE.indexIn(noteslines.at(i)) < 0)
        noteslines.replace(i, "--        " + noteslines.at(i));
  }

  if (groupline.isEmpty())
    lines.insert(0, "-- Group: " + group);
  else
    lines.insert(0, groupline);

  if (nameline.isEmpty())
    lines.insert(1, "-- Name:  " + name);
  else
    lines.insert(1, nameline);

  for (int i = 0; i < noteslines.size(); i++)
    lines.insert(i + 2, noteslines.at(i));

  query = lines.join("\n");

  return true;
}
开发者ID:IlyaDiallo,项目名称:openrpt,代码行数:59,代码来源:mqlutil.cpp

示例9: createGeographicPosition

vCardProperty vCardProperty::createGeographicPosition(qreal latitude, qreal longitude, const vCardParamList& params)
{
    QStringList values;
    values.insert(vCardProperty::Latitude, QString("%1").arg(latitude));
    values.insert(vCardProperty::Longitude, QString("%1").arg(longitude));

    return vCardProperty(VC_GEOGRAPHIC_POSITION, values, params);
}
开发者ID:InvictusInnovations,项目名称:keyhotee,代码行数:8,代码来源:vcardproperty.cpp

示例10: config

GDB::GDB() 
: sawPrompt_(false), currentCmd_(0)
{
    process_ = new KProcess(this);
    process_->setOutputChannelMode( KProcess::SeparateChannels ); 
    connect(process_, SIGNAL(readyReadStandardOutput()), 
            SLOT(readyReadStandardOutput()));
    connect(process_, SIGNAL(readyReadStandardError()), 
            SLOT(readyReadStandardError()));
    connect(process_, 
            SIGNAL(finished(int, QProcess::ExitStatus)),
            SLOT(processFinished(int, QProcess::ExitStatus)));
    connect(process_, SIGNAL(error(QProcess::ProcessError)),
            SLOT(processErrored(QProcess::ProcessError)));

    KConfigGroup config(KGlobal::config(), "GDB Debugger");    
    QString gdb = config.readEntry("GDB Path", "gdb");

    QStringList arguments;
    arguments << "--interpreter=mi2" << "-quiet";

    QString shell = config.readEntry("Debugger Shell");
    if( !shell.isEmpty() )
    {
        shell = shell.simplified();
        QString shell_without_args = shell.split(QChar(' ')).first();

        QFileInfo info( shell_without_args );
        /*if( info.isRelative() )
        {
            shell_without_args = build_dir + "/" + shell_without_args;
            info.setFile( shell_without_args );
        }*/
        if( !info.exists() )
        {
            KMessageBox::information(
                qApp->activeWindow(),
                i18n("Could not locate the debugging shell '%1'.", shell_without_args ),
                i18n("Debugging Shell Not Found") );
            // FIXME: throw, or set some error message.
            return;
        }

        arguments.insert(0, gdb );
        arguments.insert(0, shell);
        process_->setShellCommand( KShell::joinArgs( arguments ) );
    }
    else
    {
        process_->setProgram( gdb, arguments );
    }

    process_->start();

    emit userCommandOutput(shell + " " + gdb
                           + " --interpreter=mi2 -quiet\n" );
}
开发者ID:,项目名称:,代码行数:57,代码来源:

示例11: writeColor

QString ClawsMailSettings::writeColor(const QColor& col)
{
    QStringList list;
    list.insert(0, QString::number(col.red()));
    list.insert(1, QString::number(col.green()));
    list.insert(2, QString::number(col.blue()));
    if (col.alpha() != 255)
        list.insert(3, QString::number(col.alpha()));
    return list.join(QLatin1String(","));
}
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:10,代码来源:clawsmailsettings.cpp

示例12: VerifyMessage

	bool UserCommandManager::VerifyMessage (const QString& msg, 
			const QString& channelName)
	{
		const int pos = msg.indexOf (' ');
		QString cmd;
		if (msg.startsWith ('/'))
			cmd = msg.mid (1, pos).trimmed ().toLower ();
		else
			cmd = msg.left (pos).trimmed ().toLower ();

		if (!Command2Action_.contains (cmd))
			return false;

		QString message;
		QStringList messageList;
		if (pos != -1)
		{
			message = msg.mid (pos).trimmed ();
			messageList = message.split (' ');
		}

		if (cmd == "me")
		{
			messageList.insert (1, channelName);
			messageList.insert (2, "ACTION");
		}
		else if (cmd == "part" && message.isEmpty ())
			messageList << channelName; //TODO message for part
		else if (cmd == "join" && !message.isEmpty ())
		{
			QStringList channelList = messageList.first ().split (',');

			for (int i = 0; i < channelList.count (); ++i)
			{
				const QString& channel = channelList.at (i);
				if (!channel.startsWith ('#') && 
						!channel.startsWith ('+') && 
						!channel.startsWith ('&') && 
						!channel.startsWith ('!'))
					channelList [i].prepend ('#');
			}

			QString passwords;
			if (messageList.count () == 2)
				passwords = messageList.last ();
			messageList.clear ();
			messageList << channelList.join (",")
					<< passwords;
		}
		else if (cmd == "kick" && !message.isEmpty ())
			if (ISH_->IsParticipantExists (messageList.first ()))
				messageList.insert (0, channelName);
		Command2Action_ [cmd] (messageList);
		return true;
	}
开发者ID:Zereal,项目名称:leechcraft,代码行数:55,代码来源:usercommandmanager.cpp

示例13: createName

vCardProperty vCardProperty::createName(const QString& firstname, const QString& lastname, const QString& additional, const QString& prefix, const QString& suffix, const vCardParamList& params)
{
    QStringList values;
    values.insert(vCardProperty::Lastname, lastname);
    values.insert(vCardProperty::Firstname, firstname);
    values.insert(vCardProperty::Additional, additional);
    values.insert(vCardProperty::Prefix, prefix);
    values.insert(vCardProperty::Suffix, suffix);

    return vCardProperty(VC_NAME, values, params);
}
开发者ID:InvictusInnovations,项目名称:keyhotee,代码行数:11,代码来源:vcardproperty.cpp

示例14: QString

NCSLocalApplicationBridge::~NCSLocalApplicationBridge()
{
    m_process->disconnect();
    if (m_destroyProcess)
    {
        m_process->kill();
        m_process->waitForFinished();

        QProcess checker;
        QStringList checkParams;
        checkParams << m_name;
        #ifdef Q_OS_LINUX
            checker.start("pidof",checkParams,QIODevice::ReadOnly);
            checker.waitForFinished(-1);

        #elif Q_OS_WINDOWS
            params.insert(0,"/v");
            params.insert(1,"/fo");
            params.insert(2,"csv");
            params.insert(3,"|");
            params.insert(4,"findstr");
            params.insert(5,"/i");
            checker.start("tasklist",checkParams,QIODevice::ReadOnly);
            checker.waitForFinished(-1);
        #endif

        QStringList pids = QString(checker.readAllStandardOutput()).split( " ");
        QString pidString = pids.first();
        pidString.replace("\r\n","");
        pidString.replace('\n',"");
        if (pidString != "")
        {
            QProcess killer;
            QStringList killParams;
            killParams << pidString;
            #ifdef Q_OS_LINUX
                killer.start("kill",killParams,QIODevice::ReadOnly);
                killer.waitForFinished(-1);

            #elif Q_OS_WINDOWS
                killParams.insert(0,"-f");
                killParams.insert(1,"/PID");
                killer.start("taskkill",killParams,QIODevice::ReadOnly);
                killer.waitForFinished(-1);
            #endif
        }

    }
}
开发者ID:alexander-jones,项目名称:NCV,代码行数:49,代码来源:ncslocalapplicationbridge.cpp

示例15: play

void QMplayer::play(QStringList & args)
{
    showScreen(QMplayer::ScreenPlay);

    if(useBluetooth < 0)
    {
        QFile f("/etc/asound.conf");
        if(f.exists() && f.open(QIODevice::ReadOnly | QIODevice::Text))
        {
            QByteArray text = f.readAll();
            f.close();
            useBluetooth = ((text.indexOf("pcm.bluetooth") >= 0) &&
                            QMessageBox::question(this, tr("qmplayer"), tr("Use bluetooth headset?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes);
        }
    }
    if(useBluetooth > 0)
    {
        args.insert(0, "alsa:device=bluetooth");
        args.insert(0, "-ao");
    }

    PLAY:

    process = new QProcess(this);
    connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
    process->setProcessChannelMode(QProcess::ForwardedChannels);
    process->start("mplayer", args, QIODevice::ReadWrite);

    if(!process->waitForStarted(5000))
    {
       delete(process);
       process = NULL;

       if(QMessageBox::question(this, tr("qmplayer"),
                             tr("Program MPlayer must be downloaded. Please make sure you have internet connection and press yes to confirm download"),
                             QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
       {
           showScreen(QMplayer::ScreenDownload);
           if(installMplayer())
           {
               QMessageBox::information(this, tr("qmplayer"), tr("MPlayer installed sucessfully"));
               goto PLAY;
           }
           QMessageBox::warning(this, tr("qmplayer"), tr("Failed to install MPlayer"));
           showScreen(QMplayer::ScreenInit);
       }
       return;
    }
}
开发者ID:,项目名称:,代码行数:49,代码来源:


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