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


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

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


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

示例1: updateSettings

void SatellitesPlugin::updateSettings()
{
    if (!isInitialized()) {
        return;
    }

    m_satModel->clear();
    
    m_configModel->clear();
    addBuiltInDataSources();

    // (re)load data sources
    QStringList dsList = m_settings["dataSources"].toStringList();
    dsList << m_settings["userDataSources"].toStringList();
    dsList.removeDuplicates();
    foreach( const QString &ds, dsList ) {
        mDebug() << "Loading satellite data from:" << ds;
        m_satModel->downloadFile( QUrl( ds ), ds );
    }
开发者ID:Earthwings,项目名称:marble,代码行数:19,代码来源:SatellitesPlugin.cpp

示例2: systemApplicationDirs

QStringList LUtils::systemApplicationDirs(){
  //Returns a list of all the directories where *.desktop files can be found
  QStringList appDirs = QString(getenv("XDG_DATA_HOME")).split(":");
  appDirs << QString(getenv("XDG_DATA_DIRS")).split(":");
  if(appDirs.isEmpty()){ appDirs << "/usr/local/share" << "/usr/share" << LOS::AppPrefix()+"/share" << LOS::SysPrefix()+"/share" << L_SHAREDIR; }
  appDirs.removeDuplicates();
  //Now create a valid list
  QStringList out;
  for(int i=0; i<appDirs.length(); i++){
    if( QFile::exists(appDirs[i]+"/applications") ){
      out << appDirs[i]+"/applications";
      //Also check any subdirs within this directory 
      // (looking at you KDE - stick to the standards!!)
      out << LUtils::listSubDirectories(appDirs[i]+"/applications");
    }
  }
  //qDebug() << "System Application Dirs:" << out;
  return out;
}
开发者ID:Nanolx,项目名称:lumina,代码行数:19,代码来源:LUtils.cpp

示例3: saveLastFiles

void QssEditor::saveLastFiles()
{
    QStringList files;

    if(ui->toolOpen->menu())
    {
        const QList<QAction *> actions = ui->toolOpen->menu()->actions();

        foreach(QAction *a, actions)
        {
            files.append(a->text());
        }

        files.removeDuplicates();

        // maximum history size
        while(files.size() > 15)
            files.removeLast();
    }
开发者ID:CodeBees,项目名称:QssEditor-advanced,代码行数:19,代码来源:qsseditor.cpp

示例4: fillLetter

void MoveDialog::fillLetter(const QString& year)
{
    QSqlQuery q(_db);
    q.prepare("SELECT letter FROM Grades WHERE num=:yr");
    q.bindValue(":yr", year);

    if(!q.exec())
        qDebug() << "Failed to fill letterBox" << q.lastError().text();
    QStringList myNames;
    while (q.next())
        myNames.append(q.value(0).toString());

    myNames.removeDuplicates();
    if (year == cy)
        myNames.removeOne(cl);
    myNames.sort();
    ui->cbLetter->clear();
    ui->cbLetter->addItems(myNames);
}
开发者ID:pashazz,项目名称:QSchoolManager,代码行数:19,代码来源:movedialog.cpp

示例5: setGenreFilters

void MediaCenter::setGenreFilters(const QStringList &genreFilters)
{
    QStringList genresFixed = genreFilters;
    genresFixed.sort();
    genresFixed.removeDuplicates();
    genresFixed.removeAll(QString());
    genresFixed.removeAll(QString(""));
    if (m_genreFilters != genresFixed) {
        QSettings settings;
        settings.setValue(QLatin1String(CORE_GENRE_FILTERS), genresFixed);
        m_genreFilters = genresFixed;
        if (m_showCursor) {
            m_genreFiltersChanged = true;
        } else {
            m_genreFiltersChanged = false;
            emit genreFiltersChanged();
        }
    }
}
开发者ID:lemuri,项目名称:lemuri-media-center,代码行数:19,代码来源:MediaCenter.cpp

示例6:

const QStringList& ContentFactory::getSupportedExtensions()
{
    static QStringList extensions;

    if (extensions.empty())
    {
#if TIDE_ENABLE_PDF_SUPPORT
        extensions.append(PDFContent::getSupportedExtensions());
#endif
        extensions.append(SVGContent::getSupportedExtensions());
        extensions.append(ImageContent::getSupportedExtensions());
#if TIDE_ENABLE_MOVIE_SUPPORT
        extensions.append(MovieContent::getSupportedExtensions());
#endif
        extensions.removeDuplicates();
    }

    return extensions;
}
开发者ID:BlueBrain,项目名称:Tide,代码行数:19,代码来源:ContentFactory.cpp

示例7: selectedServerNodes

//----------------------------------------------------------------------------
QStringList ctkDICOMServerNodeWidget::selectedServerNodes()const
{
  Q_D(const ctkDICOMServerNodeWidget);

  QStringList nodes;
  const int count = d->NodeTable->rowCount();
  for (int row = 0; row < count; ++row)
    {
    QTableWidgetItem* item = d->NodeTable->item(row, NameColumn);
    if (item && item->checkState() == Qt::Checked)
      {
      nodes << item->text();
      }
    }
  // If there are duplicates, serverNodeParameters(QString) will behave
  // strangely
  Q_ASSERT(nodes.removeDuplicates() == 0);
  return nodes;
}
开发者ID:151706061,项目名称:CTK,代码行数:20,代码来源:ctkDICOMServerNodeWidget.cpp

示例8: getAllPortNames

QStringList Editor::getAllPortNames() const
{
	QStringList result;

	for (const Diagram * const diagram : mDiagrams.values()) {
		for (const Type * const type : diagram->types()) {
			if (dynamic_cast<const Port * const>(type)) {
				result << type->name();
			}
		}
	}

	for (const Editor * const editor : mIncludes) {
		result += editor->getAllPortNames();
	}

	result.removeDuplicates();
	return result;
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例9: createDBusSubscription

int KCupsConnection::createDBusSubscription(const QStringList &events)
{
    // Build the current list
    QStringList currentEvents;
    foreach (const QStringList &registeredEvents, m_requestedDBusEvents) {
        currentEvents << registeredEvents;
    }
    currentEvents.removeDuplicates();

    // Check if the requested events are already being asked
    bool equal = true;
    foreach (const QString &event, events) {
        if (!currentEvents.contains(event)) {
            equal = false;
            break;
        }
    }

    // Store the subscription
    int id = 1;
    if (!m_requestedDBusEvents.isEmpty()) {
        id = m_requestedDBusEvents.keys().last();
        ++id;
    }
    m_requestedDBusEvents[id] = events;

    // If the requested list is included in our request just
    // return an ID
    if (equal) {
        return id;
    }

    // If we alread have a subscription lets cancel
    // and create a new one
    if (m_subscriptionId >= 0) {
        cancelDBusSubscription();
    }

    // Canculates the new events
    renewDBusSubscription();

    return id;
}
开发者ID:freexploit,项目名称:print-manager,代码行数:43,代码来源:KCupsConnection.cpp

示例10: listPossibleDatasets

// ==============
//     Informational
// ==============
QStringList LPBackend::listPossibleDatasets(){
  QString cmd = "zpool list -H -o name";
  //Need output, so run this in a QProcess
  QProcess *proc = new QProcess;
  proc->setProcessChannelMode(QProcess::MergedChannels);
  proc->start(cmd);
  proc->waitForFinished();
  QStringList out = QString(proc->readAllStandardOutput()).split("\n");	
  delete proc;
  //Now process the output (one dataset per line - no headers)
  QStringList list;
  for(int i=0; i<out.length(); i++){
    QString ds = out[i].section("/",0,0).simplified();
    if(!ds.isEmpty()){ list << ds; }
  }
  list.removeDuplicates();
   
  return list;	
}
开发者ID:KdeOs,项目名称:pcbsd,代码行数:22,代码来源:LPBackend.cpp

示例11: editGame

void mainWindow::editGame()
{
    if(ui->tableGames->currentIndex().isValid())
    {
        QString console = ui->tableGames->model()->data(ui->tableGames->model()->index(ui->tableGames->currentIndex().row(), 0)).toString();
        QString title = ui->tableGames->model()->data(ui->tableGames->model()->index(ui->tableGames->currentIndex().row(), 1)).toString();
        QString annee = ui->tableGames->model()->data(ui->tableGames->model()->index(ui->tableGames->currentIndex().row(), 2)).toString();
        QString devs = ui->tableGames->model()->data(ui->tableGames->model()->index(ui->tableGames->currentIndex().row(), 3)).toString();

        QSqlTableModel* m = new QSqlTableModel();
        m->setTable("Consoles");
        m->removeColumn(0);
        m->select();

        QStringList list;

        for(int i = 0; i < m->rowCount(); i++)
        {
            list.append(m->record(i).value(0).toString());
        }
        list.removeDuplicates();

        editDialog* d = new editDialog(list, this, console, title, annee, devs);

        if(d->exec() == QDialog::Accepted)
        {
            QSqlQuery q;

            QString query = "UPDATE Games "
                    "SET console='" + d->console() + "', "
                    "titre='" + d->titre() + "', "
                    "annee='" + d->annee() + "', "
                    "devs='" + d->devs() + "' "
                    "WHERE console='" + console +"' AND titre='" + title + "' AND annee='"+ annee +
                    "' AND devs='" + devs + "';";

            q.exec(query);

            m_model->select();
        }
    }
}
开发者ID:Konosprod,项目名称:EDBFVG,代码行数:42,代码来源:mainwindow.cpp

示例12: QObject

Page::Page(Site *site, QMap<QString,Site*> *sites, QStringList tags, int page, int limit, QStringList postFiltering, bool smart, QObject *parent, int pool) : QObject(parent), m_site(site), m_postFiltering(postFiltering), m_errors(QStringList()), m_imagesPerPage(limit), m_currentSource(0), m_smart(smart)
{
	m_website = m_site->url();
	m_imagesCount = -1;
	m_pagesCount = -1;

    // Replace shortcuts to increase compatibility
	QString text = " "+tags.join(" ")+" ";
	text.replace(" rating:s ", " rating:safe ", Qt::CaseInsensitive)
		.replace(" rating:q ", " rating:questionable ", Qt::CaseInsensitive)
		.replace(" rating:e ", " rating:explicit ", Qt::CaseInsensitive)
		.replace(" -rating:s ", " -rating:safe ", Qt::CaseInsensitive)
		.replace(" -rating:q ", " -rating:questionable ", Qt::CaseInsensitive)
        .replace(" -rating:e ", " -rating:explicit ", Qt::CaseInsensitive);
	tags = text.split(" ", QString::SkipEmptyParts);
	tags.removeDuplicates();

    // Get the list of all enabled modifiers
	QStringList modifiers = QStringList();
	for (int i = 0; i < sites->size(); i++)
	{
		if (sites->value(sites->keys().at(i))->contains("Modifiers"))
		{ modifiers.append(sites->value(sites->keys().at(i))->value("Modifiers").trimmed().split(" ", QString::SkipEmptyParts)); }
	}
	if (m_site->contains("Modifiers"))
	{
		QStringList mods = m_site->value("Modifiers").trimmed().split(" ", QString::SkipEmptyParts);
		for (int j = 0; j < mods.size(); j++)
		{ modifiers.removeAll(mods[j]); }
	}
	for (int k = 0; k < modifiers.size(); k++)
	{ tags.removeAll(modifiers[k]); }
	m_search = tags;

    // Set values
	m_page = page;
	m_pool = pool;
	fallback(false);
	m_replyExists = false;
	m_replyTagsExists = false;
	m_currentUrl = 0;
}
开发者ID:ExKia,项目名称:imgbrd-grabber,代码行数:42,代码来源:page.cpp

示例13: flushData

void QToDoContent::flushData(const QStringList &data)
{
    int i = 0;
    QStringList  sdata = data;
    sdata.removeDuplicates();
    m_model->clear();
    setTitle(m_title);
    for ( i = 0 ; i < sdata.count(); ++i)
    {
        QList<QStandardItem*> row;
        QStandardItem *item = new QStandardItem(sdata.at(i));
        QStandardItem *check = new QStandardItem();

        item->setIcon(QIcon(":/ui/desk.ico"));

        check->setCheckable(true);
        row<<item<<check;
        m_model->appendRow(row);
    }
}
开发者ID:xiaojianwu,项目名称:QtDeskTop,代码行数:20,代码来源:qtodocontent.cpp

示例14: generateChoiceData

/*
  Generates the json string for the CHOICE type.
*/
QString CreateNewDatabase::generateChoiceData() {
    std::unique_ptr<QString> ss(new QString(""));
    QString dq("\"");
    QTextStream s(ss.get());

    QStringList choices = ui->choice_grp_choices->toPlainText().split("\n");
    choices.removeDuplicates();

    s << genericAddData()
      << quote("TYPE", "CHOICE") << ","
      << quote("CHOICES") << ":[";
    for (int x = 0; x < choices.size(); ++x) {
        s << dq << choices[x] << dq;
        if (x + 1 != choices.size())
            s << ",";
    }
    s << "]}}";

    return *s.string();
}
开发者ID:AeroNotix,项目名称:freepoint,代码行数:23,代码来源:createnewdatabase.cpp

示例15: createFileDialogFilter

QString BAbstractFileType::createFileDialogFilter() const
{
    QString desc = description();
    QStringList sl = suffixes();
    if (desc.isEmpty() || sl.isEmpty())
        return "";
    QString filter;
    filter += desc + " (";
    if (sl.contains("*"))
        sl.clear();
    sl.removeDuplicates();
    if (!sl.isEmpty()) {
        for (int i = 0; i < sl.size(); ++i)
            filter += "*." + sl.at(i) + (i < sl.size() - 1 ? " " : "");
    }
    else
        filter += "*";
    filter += ")";
    return filter;
}
开发者ID:ololoepepe,项目名称:BeQt,代码行数:20,代码来源:babstractfiletype.cpp


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