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


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

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


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

示例1: d

static QVector< deviceList > _getDevices()
{
	const char * p = "/dev/disk/by-id/" ;

	QDir d( p ) ;
	QDir e ;

	QStringList l = d.entryList() ;

	l.removeOne( "." ) ;
	l.removeOne( ".." ) ;

	QVector< deviceList > devices ;

	if( l.isEmpty() ){

		return devices ;
	}else{
		for( const auto& it : l ){

			e.setPath ( p + it ) ;

			devices.append( deviceList( e.canonicalPath(),it ) ) ;
		}
	}

	return devices ;
}
开发者ID:joachimdostal,项目名称:zuluCrypt,代码行数:28,代码来源:zulumounttask.cpp

示例2: askForKingdom

QString TrustAI::askForKingdom() {
    QString role;
    ServerPlayer *lord = room->getLord();
    QStringList kingdoms = Sanguosha->getKingdoms();
    kingdoms.removeOne("god");
    if (!lord) return kingdoms.at(qrand() % kingdoms.length());

    switch(self->getRoleEnum()) {
    case Player::Lord: role = kingdoms.at(qrand() % kingdoms.length()); break;
    case Player::Renegade:
    case Player::Rebel: {
            if ((lord->hasLordSkill("xueyi") && self->getRoleEnum() == Player::Rebel) || lord->hasLordSkill("shichou"))
                role = "wei";
            else
                role = lord->getKingdom();
            break;
    }
    case Player::Loyalist: {
            if (lord->getGeneral()->isLord())
                role = lord->getKingdom();
            else if (lord->getGeneral2() && lord->getGeneral2()->isLord())
                role = lord->getGeneral2()->getKingdom();
            else {
                if (lord->hasSkill("yongsi")) kingdoms.removeOne(lord->getKingdom());
                role = kingdoms.at(qrand() % kingdoms.length());
            }
            break;
        }
    default:
            break;
    }

    return role;
}
开发者ID:0147certainly,项目名称:QSanguoshaForDadao,代码行数:34,代码来源:ai.cpp

示例3: removeItemListBook

//---------------------------------------
void FRDialog::removeItemListBook(QStringList &list)
{
    QStringList listb;
    int i = 1;
    while (i < list.size())
    {
        if (
                ( list.at(i).indexOf(GL_PROJECT_FILE) >= 0 ) or
                ( list.at(i).indexOf("chapter") >= 0) or
                ( list.at(i).indexOf("export") >= 0 )
                )
        {
            list.removeAt(i);
            --i;
        }
        else
        {
            QString filename = Config::configuration()->CurPrjDir() + "/" +
                    list.at(i);
//            qDebug() << "filename = " << filename
//                     << " param = " << getParamBook(filename, "FullName");
            QString bookfilename = QString(list.at(i)).remove("book_").remove(".htm");
            QString app = getParamBook(filename, "FullName");
            listb << app;
            bookfiles << bookfilename;
        }
        ++i;
    }
    listb.removeOne(GL_PROJECT_FILE);
    listb.removeOne("");
    listb.removeOne("help");
    listb.removeDuplicates();
    list = listb;
}
开发者ID:WarmongeR1,项目名称:bQella,代码行数:35,代码来源:frdialog.cpp

示例4: checkForOldUserTemplates

// Originally user templates were stored whereever the user wanted and maintained in the option "User/Templates".
// This behavior has now been changed to always store user templates in [config]/templates/user/ The advantage is
// that we don't have to maintain the template list and it's not lost when resetting the configuration.
// This function allows to move existing templates to the the new location.
void TemplateManager::checkForOldUserTemplates() {
	ConfigManagerInterface *cfg = ConfigManager::getInstance();
	if (!cfg) return;
	QStringList userTemplateList = cfg->getOption("User/Templates").toStringList();
	if (!userTemplateList.isEmpty()) {
		bool move = txsConfirmWarning(tr("TeXstudio found user templates in deprecated locations.\n"
							"From now on user templates are hosted at\n%1\n"
							"Should TeXstudio move the existing user templates there?\n"
							"If not, they will not be available via the Make Template dialog.").arg(userTemplateDir()));
		if (move) {
			foreach (const QString &fname, userTemplateList) {
				QFileInfo fi(fname);
				if (!fi.exists()) {
					userTemplateList.removeOne(fname);
					continue;
				}
				QString newName = userTemplateDir() + fi.fileName();
				if (!QFile::copy(fname, newName)) {
					txsWarning(tr("Copying template from\n%1\nto\n%2\nfailed.").arg(fname).arg(newName));
				} else {
					if (!QFile::remove(fname)) {
						txsInformation(tr("File\n%1\n could not be removed.").arg(fname));
					}
					userTemplateList.removeOne(fname);
				}
			}
		}
开发者ID:svn2github,项目名称:texstudio,代码行数:31,代码来源:templatemanager.cpp

示例5: availableLanguages

QStringList availableLanguages()
{
    QDir dir;
    dir.setPath(datadir() + LANGUAGEROOT);

    // add all translations
    QStringList filters;
    filters << "*.qm";
    dir.setNameFilters(filters);
    dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);

    // remove extension
    QStringList list = dir.entryList();
    list.replaceInStrings(".qm", "");

    // remove system translations
    foreach (QString str, list)
    {
        if (str.startsWith("qt_"))
            list.removeOne(str);
        if (str.startsWith("plugin_"))
            list.removeOne(str);
    }

    return list;
}
开发者ID:panek50,项目名称:agros2d,代码行数:26,代码来源:util.cpp

示例6: findFiles

//---------------------------------------
QStringList FRDialog::findFiles(const QStringList &files, const QString &text)
{
    QProgressDialog progressDialog(this);
    progressDialog.setCancelButtonText(tr("&Cancel"));
    progressDialog.setRange(0, files.size());
    progressDialog.setWindowTitle(tr("Find Files"));
    QStringList foundFiles;
    for (int i = 0; i < files.size(); ++i) {
        progressDialog.setValue(i);
        progressDialog.setLabelText(tr("Searching file number %1 of %2...")
                                    .arg(i).arg(files.size()));
        qApp->processEvents();

        if (progressDialog.wasCanceled())
            break;

        QFile file(currentDir.absoluteFilePath(files[i]));
        if (file.open(QIODevice::ReadOnly)) {
            QString line;
            QTextStream in(&file);
            while (!in.atEnd()) {
                if (progressDialog.wasCanceled())
                    break;
                line = in.readLine();
                if (line.contains(text)) {
                    foundFiles << files[i];
                    break;
                }
            }
        }
    }
    foundFiles.removeOne("   ___Instruction");
    foundFiles.removeOne(Config::configuration()->CurProject().split("/").last());
    return foundFiles;
}
开发者ID:WarmongeR1,项目名称:bQella,代码行数:36,代码来源:frdialog.cpp

示例7: propertiesChanged

void RemoteActivatable::propertiesChanged(const QVariantMap &changedProperties)
{
    Q_D(RemoteActivatable);
    QStringList propKeys = changedProperties.keys();
    QLatin1String deviceUniKey("deviceUni"),
                  activatableTypeKey("activatableType"),
                  sharedKey("shared");
    QVariantMap::const_iterator it = changedProperties.find(deviceUniKey);
    if (it != changedProperties.end())
    {
        d->deviceUni = it->toString();
        propKeys.removeOne(deviceUniKey);
    }
    it = changedProperties.find(activatableTypeKey);
    if (it != changedProperties.end())
    {
        d->activatableType = (Knm::Activatable::ActivatableType)it->toUInt();
        propKeys.removeOne(activatableTypeKey);
    }
    it = changedProperties.find(sharedKey);
    if (it != changedProperties.end())
    {
        d->shared = it->toBool();
        propKeys.removeOne(sharedKey);
    }
    /*if (propKeys.count()) {
        qDebug() << "Unhandled properties: " << propKeys;
    }*/
}
开发者ID:Kermit,项目名称:nm-applet-qt,代码行数:29,代码来源:remoteactivatable.cpp

示例8: checkCall

/*!
 * Verifica si la aplicación ha sido invocada de manera correcta.
 * En caso afirmativo, retorna los paths de las imágenes a procesar y setea los flags correspondientes.
 * En caso negativo, se imprime la ayuda por pantalla.
 */
void checkCall(int argc, char *argv[], QString &path1, QString &path2)
{
    QString arg;
    QStringList qArgs;   
    for(int i=1; i<argc; i++)
        qArgs << QString(argv[i]).toLower();
    if(qArgs.contains("-h"))
        printHelp();
    if(qArgs.contains("--build")){
        BUILD = true;
        qArgs.removeOne("--build");
        if(qArgs.size() != 1)
            printHelp();
        path1 = qArgs[0];
    }else{
        if(qArgs.contains("--add")){
            ADD = true;
            qArgs.removeOne("--add");
            if(qArgs.size() != 1)
                printHelp();
            path1 = qArgs[0];
        }else{
            if(qArgs.contains("--search")){
                SEARCH = true;
                qArgs.removeOne("--search");
                if(qArgs.size() != 1)
                    printHelp();
                path1 = qArgs[0];
            }else{
                for(int i=0; i<qArgs.size(); i++){
                    arg = qArgs[i];
                    if(arg == "-v"){
                        VERBOSE = true;
                        qArgs.removeAt(i--);
                        continue;
                    }
                    if(arg == "-g"){
                        GRAPHIC = true;
                        qArgs.removeAt(i--);
                    }
                }
                if(qArgs.size() != 2)
                    printHelp();
                path1 = qArgs[0];
                path2 = qArgs[1];
            }
        }
    }
}
开发者ID:chiiph,项目名称:keepc,代码行数:54,代码来源:main.cpp

示例9: askForKingdom

QString TrustAI::askForKingdom()
{
    QString role;
    ServerPlayer *lord = room->getLord();
    QStringList kingdoms = Sanguosha->getKingdoms();
    kingdoms.removeOne("zhu");
    kingdoms.removeOne("touhougod");
    QString selfKingdom = self->getGeneral()->getKingdom();
    if (!lord) return kingdoms.at(qrand() % kingdoms.length());

    switch (self->getRoleEnum()) {
    case Player::Lord: role = kingdoms.at(qrand() % kingdoms.length()); break;
    case Player::Renegade:{
        if (lord->getGeneral()->isLord() || self->hasSkill("hongfo"))
            role = lord->getKingdom();
        else if (lord->getGeneral2() && lord->getGeneral2()->isLord())
            role = lord->getGeneral2()->getKingdom();
        else
            role = kingdoms.at(qrand() % kingdoms.length());
        break;
    }
    case Player::Rebel: {
        if (self->hasSkill("hongfo")) {
            kingdoms.removeOne(lord->getKingdom());
            role = kingdoms.at(qrand() % kingdoms.length());
        } else if (lord->getGeneral()->isLord())
            role = lord->getKingdom();
        else
            role = kingdoms.at(qrand() % kingdoms.length());
        break;
    }
    case Player::Loyalist: {
        if (lord->getGeneral()->isLord() || self->hasSkill("hongfo"))
            role = lord->getKingdom();
        else if (lord->getGeneral2() && lord->getGeneral2()->isLord())
            role = lord->getGeneral2()->getKingdom();
        else {
            role = kingdoms.at(qrand() % kingdoms.length());
        }
        break;
    }
    default:
        break;
    }
    if (kingdoms.contains(role))
        return role;
    else
        return "wai";
}
开发者ID:LGCaerwyn,项目名称:touhoukill,代码行数:49,代码来源:ai.cpp

示例10: data

QVariant SongsDataModel::data(const QVariantList& indexPath)
{
    QVariantMap data;
    QDir dir = QDir::home();
    if (dir.cd("songs")) {
        QStringList listOfFiles = dir.entryList(QDir::Dirs);
        listOfFiles.removeOne(".");
        listOfFiles.removeOne("..");
//		data["albumName"] = listOfFiles.at(indexPath[0].toInt());
//		data["itemsCount"] = getItemsCount(listOfFiles.at(indexPath[0].toInt()));
        data["albumName"] = "songs";
        //data["itemsCount"] = getItemsCount(listOfFiles.at(indexPath[0].toInt()));
    }
    return data;
}
开发者ID:sanjayasl,项目名称:RocknRoll,代码行数:15,代码来源:songsmodel.cpp

示例11: askForKingdom

QString TrustAI::askForKingdom()
{
    QString role;
    ServerPlayer *lord = room->getLord();
    QStringList kingdoms = Sanguosha->getKingdoms();
    kingdoms.removeOne("god");
    if (!lord) return kingdoms.at(qrand() % kingdoms.length());

    switch (self->getRoleEnum()) {
    case Player::Lord: role = kingdoms.at(qrand() % kingdoms.length()); break;
    case Player::Renegade:
    case Player::Rebel: {
            role = lord->getKingdom();
        break;
    }
    case Player::Loyalist: {
            role = kingdoms.at(qrand() % kingdoms.length());
        break;
    }
    default:
        break;
    }

    return role;
}
开发者ID:DGAH,项目名称:QSanguosha-PK,代码行数:25,代码来源:ai.cpp

示例12: setModemPath

void QOfonoRadioSettings::setModemPath(const QString &path)
{
    if (path == d_ptr->modemPath ||
            path.isEmpty())
        return;

    QStringList removedProperties = d_ptr->properties.keys();

    delete d_ptr->radioSettings;
    d_ptr->radioSettings = new OfonoRadioSettings("org.ofono", path, QDBusConnection::systemBus(),this);

    if (d_ptr->radioSettings->isValid()) {
        d_ptr->modemPath = path;

        connect(d_ptr->radioSettings,SIGNAL(PropertyChanged(QString,QDBusVariant)),
                this,SLOT(propertyChanged(QString,QDBusVariant)));

        QVariantMap properties = d_ptr->radioSettings->GetProperties().value();
        for (QVariantMap::ConstIterator it = properties.constBegin();
             it != properties.constEnd(); ++it) {
            updateProperty(it.key(), it.value());
            removedProperties.removeOne(it.key());
        }

        Q_EMIT modemPathChanged(path);
    }

    foreach (const QString &p, removedProperties)
        updateProperty(p, QVariant());
}
开发者ID:amccarthy,项目名称:libqofono,代码行数:30,代码来源:qofonoradiosettings.cpp

示例13: on_mRemoveDirectoryButton_clicked

void QgsComposerPictureWidget::on_mRemoveDirectoryButton_clicked()
{
  QString directoryToRemove = mSearchDirectoriesComboBox->currentText();
  if ( directoryToRemove.isEmpty() )
  {
    return;
  }
  mSearchDirectoriesComboBox->removeItem( mSearchDirectoriesComboBox->currentIndex() );

  //remove entries from back to front (to have the indices of existing items constant)
  for ( int i = ( mPreviewListWidget->count() - 1 ); i >= 0; --i )
  {
    QListWidgetItem* currentItem = mPreviewListWidget->item( i );
    if ( currentItem && currentItem->data( Qt::UserRole ).toString().startsWith( directoryToRemove ) )
    {
      delete( mPreviewListWidget->takeItem( i ) );
    }
  }

  //update the image directory list in the settings
  QSettings s;
  QStringList userDirList = s.value( "/Composer/PictureWidgetDirectories" ).toStringList();
  userDirList.removeOne( directoryToRemove );
  s.setValue( "/Composer/PictureWidgetDirectories", userDirList );
}
开发者ID:Br1ndavoine,项目名称:QGIS,代码行数:25,代码来源:qgscomposerpicturewidget.cpp

示例14: makeData

void WinetricksModel::makeData()
{
	//run winetricks
	QProcess p;
	if (wtricks.isEmpty() || (!QFileInfo(wtricks).isFile()))
		wtricks = "winetricks";
	p.start(wtricks, QStringList("help"));
	p.waitForFinished();
	QStringList rawStr = QString (p.readAllStandardOutput()).split("\n", QString::SkipEmptyParts);
	//Remove non-splittable entries from the array
	while (rawStr.first() != "Packages:")
	{
		rawStr.removeFirst();
	}

	// parse list step by step
	foreach (QString str, rawStr)
	{
		if (str.endsWith(":")) //packages: pseudopackages: etc
		{
			rawStr.removeOne(str);
			continue;
		}
	list.append(getTrix (str));
	}
}
开发者ID:pashazz,项目名称:winegame,代码行数:26,代码来源:winetricksmodel.cpp

示例15: GetRawImage

bool DcRawQT::GetRawImage(QString filename, QStringList args)
{
    int argc;
    char **argv;


	if(args.contains("-i")){
		args.removeOne("-i");
		qDebug("-i passed to GetRawImage");
	}

    args += filename;
    argc = BuildCommandLine(args, &argv);

	if(GetRawImage(argc, argv))
	{
		buildHistogram();

		return true;
	}

	return false;


}
开发者ID:discordj,项目名称:DcRawQT,代码行数:25,代码来源:dcrawqt.cpp


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