本文整理汇总了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 ;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}*/
}
示例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];
}
}
}
}
示例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";
}
示例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;
}
示例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;
}
示例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());
}
示例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 );
}
示例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));
}
}
示例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;
}