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


C++ qStableSort函数代码示例

本文整理汇总了C++中qStableSort函数的典型用法代码示例。如果您正苦于以下问题:C++ qStableSort函数的具体用法?C++ qStableSort怎么用?C++ qStableSort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: qStableSort

bool ShiftManipulator::preProcessing()
{
    if (m_firstrun) {
        // If we have an NCS, create a child command for each element.
        if (cells().count() > 1) { // non-contiguous selection
            // Sort the elements by their top row.
            if (m_direction == ShiftBottom) {
                qStableSort(cells().begin(), cells().end(), topRowLessThan);
            } else { // ShiftRight
                qStableSort(cells().begin(), cells().end(), leftColumnLessThan);
            }
            // Create sub-commands.
            const KCRegion::ConstIterator end(constEnd());
            for (KCRegion::ConstIterator it = constBegin(); it != end; ++it) {
                ShiftManipulator *const command = new ShiftManipulator(this);
                command->setSheet(m_sheet);
                command->add(KCRegion((*it)->rect(), (*it)->sheet()));
                if (m_mode == Delete) {
                    command->setReverse(true);
                }
                command->setDirection(m_direction);
            }
        } else { // contiguous selection
            m_sheet->cellStorage()->startUndoRecording();
        }
    }
    return KCAbstractRegionCommand::preProcessing();
}
开发者ID:KDE,项目名称:koffice,代码行数:28,代码来源:DataManipulators.cpp

示例2: qStableSort

void SM_ModelBackend::sortData()
{

    qStableSort(SubnetList.begin(), SubnetList.end(), SM_ModelBackend::SubnetLessThan);
    qStableSort(Subnet4List.begin(), Subnet4List.end(), SM_ModelBackend::SubnetLessThan);
    qStableSort(Subnet6List.begin(), Subnet6List.end(), SM_ModelBackend::SubnetLessThan);

}
开发者ID:lordwolfchild,项目名称:subnetmapper,代码行数:8,代码来源:sm_modelbackend.cpp

示例3: qStableSort

void QUSongFileData::sort(QList<QUSongFile*> &songs) {
	if(this->next())
		this->next()->sort(songs);

	if(QString::compare(_property, "path", Qt::CaseInsensitive) == 0)
		qStableSort(songs.begin(), songs.end(), QUSongFile::pathLessThan);
	else if(QString::compare(_property, "filePath", Qt::CaseInsensitive) == 0)
		qStableSort(songs.begin(), songs.end(), QUSongFile::filePathLessThan);
	else if(QString::compare(_property, "relativeFilePath", Qt::CaseInsensitive) == 0)
		qStableSort(songs.begin(), songs.end(), QUSongFile::relativeFilePathLessThan);
}
开发者ID:escaped,项目名称:uman,代码行数:11,代码来源:QUSongFileData.cpp

示例4: qStableSort

void MusicNode::sort()
{
    //  Sort any tracks
    qStableSort(my_tracks.begin(), my_tracks.end(), meta_less_than);

    //  Sort any subnodes
    qStableSort(my_subnodes.begin(), my_subnodes.end(), music_less_than);

    //  Tell any subnodes to sort themselves
    MusicNodePtrList::const_iterator sit = my_subnodes.begin();
    for (; sit != my_subnodes.end(); ++sit)
        (*sit)->sort();
}
开发者ID:Cougar,项目名称:mythtv,代码行数:13,代码来源:metadata.cpp

示例5: lock

void SymbianDeviceManager::update(bool emitSignals)
{
    QMutexLocker lock(&d->m_devicesLock);

    static int n = 0;
    typedef SymbianDeviceList::iterator SymbianDeviceListIterator;

    if (debug)
        qDebug(">SerialDeviceLister::update(#%d, signals=%d)\n%s", n++, int(emitSignals),
               qPrintable(toString()));

    d->m_initialized = true;
    // Get ordered new list
    SymbianDeviceList newDevices = serialPorts() + blueToothDevices();
    if (newDevices.size() > 1)
        qStableSort(newDevices.begin(), newDevices.end());
    if (d->m_devices == newDevices) { // Happy, nothing changed.
        if (debug)
            qDebug("<SerialDeviceLister::update: unchanged\n");
        return;
    }
    // Merge the lists and emit the respective added/removed signals, assuming
    // no one can plug a different device on the same port at the speed of lightning
    SymbianDeviceList removedDevices;
    if (!d->m_devices.isEmpty()) {
        // Find deleted devices
        for (SymbianDeviceListIterator oldIt = d->m_devices.begin(); oldIt != d->m_devices.end(); ) {
            if (newDevices.contains(*oldIt)) {
                ++oldIt;
            } else {
                SymbianDevice toBeDeleted = *oldIt;
                toBeDeleted.forcedClose();
                oldIt = d->m_devices.erase(oldIt);
                removedDevices.append(toBeDeleted);
            }
        }
    }
    SymbianDeviceList addedDevices;
    if (!newDevices.isEmpty()) {
        // Find new devices and insert in order
        foreach(const SymbianDevice &newDevice, newDevices) {
            if (!d->m_devices.contains(newDevice)) {
                d->m_devices.append(newDevice);
                addedDevices.append(newDevice);
            }
        }
        if (d->m_devices.size() > 1)
            qStableSort(d->m_devices.begin(), d->m_devices.end());
    }
开发者ID:mohdpatah,项目名称:qt,代码行数:49,代码来源:symbiandevicemanager.cpp

示例6: qStableSort

void DesktopSortingStrategy::sortItems(ItemList &items)
{
    GroupManager *gm = qobject_cast<GroupManager *>(parent());
    qStableSort(items.begin(), items.end(), (gm && gm->separateLaunchers()) ?
                DesktopSortingStrategy::lessThanSeperateLaunchers :
                DesktopSortingStrategy::lessThan);
}
开发者ID:mgottschlag,项目名称:kwin-tiling,代码行数:7,代码来源:desktopsortingstrategy.cpp

示例7: setSubTitle

void GitoriousRepositoryWizardPage::initializePage()
{
    // Populate the model
    ui->repositoryTreeView->selectionModel()->clearSelection();
    if (const int oldRowCount = m_model->rowCount())
        m_model->removeRows(0, oldRowCount);
    ui->filterLineEdit->clear();
    // fill model
    const QSharedPointer<GitoriousProject> proj = m_projectPage->project();
    setSubTitle(tr("Choose a repository of the project '%1'.").arg(proj->name));
    // Create a hierarchical list by repository type, sort by type
    QList<GitoriousRepository> repositories = proj->repositories;
    QStandardItem *firstEntry = 0;
    if (!repositories.empty()) {
        int lastRepoType = -1;
        QStandardItem *header = 0;
        qStableSort(repositories.begin(), repositories.end(), gitRepoLessThanByType);
        const QString types[GitoriousRepository::PersonalRepository + 1] =
            { tr("Mainline Repositories"), tr("Clones"), tr("Baseline Repositories"), tr("Shared Project Repositories"), tr("Personal Repositories") };
        foreach(const GitoriousRepository &r, repositories) {
            // New Header?
            if (r.type != lastRepoType || !header) {
                lastRepoType = r.type;
                const QList<QStandardItem *> headerRow = headerEntry(types[r.type]);
                m_model->appendRow(headerRow);
                header = headerRow.front();
            }
            // Repository row
            const QList<QStandardItem *> row = repositoryEntry(r);
            header->appendRow(row);
            if (!firstEntry)
                firstEntry = row.front();
        }
    }
开发者ID:mornelon,项目名称:QtCreator_compliments,代码行数:34,代码来源:gitoriousrepositorywizardpage.cpp

示例8: Q_UNUSED

void
TwitterSipPlugin::accountAuthenticated( const QWeakPointer< TomahawkOAuthTwitter > &twitterAuth, const QTweetUser &user )
{
    Q_UNUSED( user );

    if ( !m_account->enabled() || !m_account->isAuthenticated() )
        return;

    m_cachedTwitterAuth = twitterAuth;

    m_friendsTimeline = QWeakPointer<QTweetFriendsTimeline>( new QTweetFriendsTimeline( m_cachedTwitterAuth.data(), this ) );
    m_mentions = QWeakPointer<QTweetMentions>( new QTweetMentions( m_cachedTwitterAuth.data(), this ) );
    m_directMessages = QWeakPointer<QTweetDirectMessages>( new QTweetDirectMessages( m_cachedTwitterAuth.data(), this ) );
    m_directMessageNew = QWeakPointer<QTweetDirectMessageNew>( new QTweetDirectMessageNew( m_cachedTwitterAuth.data(), this ) );
    m_directMessageDestroy = QWeakPointer<QTweetDirectMessageDestroy>( new QTweetDirectMessageDestroy( m_cachedTwitterAuth.data(), this ) );
    connect( m_friendsTimeline.data(), SIGNAL( parsedStatuses(const QList< QTweetStatus > &) ), SLOT( friendsTimelineStatuses(const QList<QTweetStatus> &) ) );
    connect( m_mentions.data(), SIGNAL( parsedStatuses(const QList< QTweetStatus > &) ), SLOT( mentionsStatuses(const QList<QTweetStatus> &) ) );
    connect( m_directMessages.data(), SIGNAL( parsedDirectMessages(const QList<QTweetDMStatus> &)), SLOT( directMessages(const QList<QTweetDMStatus> &) ) );
    connect( m_directMessageNew.data(), SIGNAL( parsedDirectMessage(const QTweetDMStatus &)), SLOT( directMessagePosted(const QTweetDMStatus &) ) );
    connect( m_directMessageNew.data(), SIGNAL( error(QTweetNetBase::ErrorCode, const QString &) ), SLOT( directMessagePostError(QTweetNetBase::ErrorCode, const QString &) ) );
    connect( m_directMessageDestroy.data(), SIGNAL( parsedDirectMessage(const QTweetDMStatus &) ), SLOT( directMessageDestroyed(const QTweetDMStatus &) ) );
    m_state = Tomahawk::Accounts::Account::Connected;
    emit stateChanged( m_state );
    QStringList peerList = m_cachedPeers.keys();
    qStableSort( peerList.begin(), peerList.end() );
    registerOffers( peerList );
    m_connectTimer.start();
    m_checkTimer.start();
    m_dmPollTimer.start();

    QMetaObject::invokeMethod( this, "checkTimerFired", Qt::AutoConnection );
    QTimer::singleShot( 20000, this, SLOT( connectTimerFired() ) );
}
开发者ID:MechanisM,项目名称:tomahawk,代码行数:33,代码来源:twittersip.cpp

示例9: qStableSort

void FunctionConfig::reload() {
	_size = 0;

	if (_points.size())
		qStableSort(_points.begin(), _points.end(), sortFn);

	if (_data)
        delete[] _data;
	_data = NULL;
	if (_points.size()) {
        _data = new float[_size = MEMOIZE_PRECISION * _points[_points.size() - 1].x()];

        for (int i = 0; i < _size; i++)
                _data[i] = -1e6;

		for (int k = 0; k < _points[0].x() * MEMOIZE_PRECISION; k++) {
            if (k < _size)
                _data[k] = _points[0].y() * k / (_points[0].x() * MEMOIZE_PRECISION);
        }

       for (int i = 0; i < _points.size(); i++) {
            QPointF p0 = ensureInBounds(_points, i - 1);
            QPointF p1 = ensureInBounds(_points, i);
            QPointF p2 = ensureInBounds(_points, i + 1);
            QPointF p3 = ensureInBounds(_points, i + 2);

            int end = p2.x() * MEMOIZE_PRECISION;
            int start = p1.x() * MEMOIZE_PRECISION;

            for (int j = start; j < end && j < _size; j++) {
                double t = (j - start) / (double) (end - start);
                double t2 = t*t;
                double t3 = t*t*t;

                int x = .5 * ((2. * p1.x()) +
                              (-p0.x() + p2.x()) * t +
                              (2. * p0.x() - 5. * p1.x() + 4. * p2.x() - p3.x()) * t2 +
                              (-p0.x() + 3. * p1.x() - 3. * p2.x() + p3.x()) * t3)
                        * MEMOIZE_PRECISION;

                float y = .5 * ((2. * p1.y()) +
                                 (-p0.y() + p2.y()) * t +
                                 (2. * p0.y() - 5. * p1.y() + 4. * p2.y() - p3.y()) * t2 +
                                 (-p0.y() + 3. * p1.y() - 3. * p2.y() + p3.y()) * t3);

                if (x >= 0 && x < _size)
                    _data[x] = y;
            }
		}

       float last = 0;

       for (int i = 0; i < _size; i++)
       {
           if (_data[i] == -1e6)
               _data[i] = last;
           last = _data[i];
       }
	}
}
开发者ID:JaguarIV,项目名称:opentrack,代码行数:60,代码来源:functionconfig.cpp

示例10: Q_UNUSED

bool
TwitterPlugin::connectPlugin( bool startup )
{
    Q_UNUSED( startup );
    qDebug() << Q_FUNC_INFO;

    m_cachedPeers = twitterCachedPeers();
    QStringList peerList = m_cachedPeers.keys();
    qStableSort( peerList.begin(), peerList.end() );

    registerOffers( peerList );

    if ( twitterOAuthToken().isEmpty() || twitterOAuthTokenSecret().isEmpty() )
    {
        qDebug() << "TwitterPlugin has empty Twitter credentials; not connecting";
        return m_cachedPeers.isEmpty();
    }

    if ( refreshTwitterAuth() )
    {
      QTweetAccountVerifyCredentials *credVerifier = new QTweetAccountVerifyCredentials( m_twitterAuth.data(), this );
      connect( credVerifier, SIGNAL( parsedUser(const QTweetUser &) ), SLOT( connectAuthVerifyReply(const QTweetUser &) ) );
      credVerifier->verify();

      m_state = Connecting;
      emit stateChanged( m_state );
    }

    return true;
}
开发者ID:Pritoj,项目名称:tomahawk,代码行数:30,代码来源:twitter.cpp

示例11: qStableSort

QString Molecule::rawFormula() const{
	QList<const Element*> key = this->keys();	//	the list of element
	qStableSort(key.begin(), key.end(), Element::symbolCompare);	//	sortened by Alphabetical order
	QString rawFormula("");											//	an for the moment empty raw Formula
	foreach(const Element* el, key){								//	foreach element
		rawFormula += el->symbol() + this->value(el);				//	we append its symbol and count
	}
开发者ID:GuillaumeDIDIER,项目名称:Progress-Table-Generator,代码行数:7,代码来源:Molecule.cpp

示例12: qStableSort

void Generator::generate()
{
    if (m_classes.size() == 0) {
        ReportHandler::warning(QString("%1: no java classes, skipping")
                               .arg(metaObject()->className()));
        return;
    }

    qStableSort(m_classes);

    foreach (AbstractMetaClass *cls, m_classes) {
        if (!shouldGenerate(cls))
            continue;

        QString fileName = fileNameForClass(cls);
        ReportHandler::debugSparse(QString("generating: %1").arg(fileName));

        FileOut fileOut(outputDirectory() + "/" + subDirectoryForClass(cls) + "/" + fileName);
        write(fileOut.stream, cls);

        if( fileOut.done() )
            ++m_num_generated_written;
        ++m_num_generated;
    }
}
开发者ID:Alzathar,项目名称:PythonQt,代码行数:25,代码来源:generator.cpp

示例13: qStableSort

void FcitxIMPage::Private::moveUpIM()
{
    QModelIndex curIndex = currentIMView->currentIndex();
    if (curIndex.isValid() && curIndex.row() > 0) {
        QModelIndex nextIndex = currentIMModel->index(curIndex.row() - 1, 0);

        FcitxIM* curIM = static_cast<FcitxIM*>(curIndex.internalPointer());
        FcitxIM* nextIM = static_cast<FcitxIM*>(nextIndex.internalPointer());

        if (curIM == NULL || nextIM == NULL)
            return;

        int i = 0, curIMIdx = -1, nextIMIdx = -1;
        for (i = 0; i < m_list.size(); i ++) {
            if (curIM->uniqueName() == m_list[i].uniqueName())
                curIMIdx = i;

            if (nextIM->uniqueName() == m_list[i].uniqueName())
                nextIMIdx = i;
        }

        if (curIMIdx >= 0 && nextIMIdx >= 0 && curIMIdx != nextIMIdx) {
            m_list.swap(curIMIdx, nextIMIdx);
            qStableSort(m_list.begin(), m_list.end());
            emit updateIMList(curIM->uniqueName());
            emit changed();
        }
    }
}
开发者ID:pkg-ime,项目名称:kcm-fcitx,代码行数:29,代码来源:FcitxIMPage.cpp

示例14: selectedRange

void Spreadsheet::sort(const SpreadsheetCompare &compare)
{
    QList<QStringList> rows;
    QTableWidgetSelectionRange range = selectedRange();
    int i;

    for(i = 0; i < range.rowCount(); ++i)
    {
        QStringList row;
        for(int j = 0; j < range.columnCount(); ++j)
            row.append(formula(range.topRow() + i, range.leftColumn() + j));

        rows.append(row);
    }


    qStableSort(rows.begin(), rows.end(), compare);

    for(i = 0; i < range.rowCount(); ++i)
    {
        for(int j = 0; j < range.columnCount(); ++j)
            setFormula(range.topRow() + i, range.leftColumn() + j, rows[i][j]);
    }

    clearSelection();
    somethingChanged();
}
开发者ID:KleineKarsten,项目名称:CppGuiWithQt,代码行数:27,代码来源:spreadsheet.cpp

示例15: QDialog

OrganiseDialog::OrganiseDialog(TaskManager* task_manager, QWidget* parent)
    : QDialog(parent),
      ui_(new Ui_OrganiseDialog),
      task_manager_(task_manager),
      total_size_(0),
      resized_by_user_(false) {
  ui_->setupUi(this);
  connect(ui_->button_box->button(QDialogButtonBox::Reset), SIGNAL(clicked()),
          SLOT(Reset()));

  ui_->aftercopying->setItemIcon(1, IconLoader::Load("edit-delete"));

  // Valid tags
  QMap<QString, QString> tags;
  tags[tr("Title")] = "title";
  tags[tr("Album")] = "album";
  tags[tr("Artist")] = "artist";
  tags[tr("Artist's initial")] = "artistinitial";
  tags[tr("Album artist")] = "albumartist";
  tags[tr("Composer")] = "composer";
  tags[tr("Performer")] = "performer";
  tags[tr("Grouping")] = "grouping";
  tags[tr("Lyrics")] = "lyrics";
  tags[tr("Track")] = "track";
  tags[tr("Disc")] = "disc";
  tags[tr("BPM")] = "bpm";
  tags[tr("Year")] = "year";
  tags[tr("Genre")] = "genre";
  tags[tr("Comment")] = "comment";
  tags[tr("Length")] = "length";
  tags[tr("Bitrate", "Refers to bitrate in file organise dialog.")] = "bitrate";
  tags[tr("Samplerate")] = "samplerate";
  tags[tr("File extension")] = "extension";

  // Naming scheme input field
  new OrganiseFormat::SyntaxHighlighter(ui_->naming);

  connect(ui_->destination, SIGNAL(currentIndexChanged(int)),
          SLOT(UpdatePreviews()));
  connect(ui_->naming, SIGNAL(textChanged()), SLOT(UpdatePreviews()));
  connect(ui_->replace_ascii, SIGNAL(toggled(bool)), SLOT(UpdatePreviews()));
  connect(ui_->replace_the, SIGNAL(toggled(bool)), SLOT(UpdatePreviews()));
  connect(ui_->replace_spaces, SIGNAL(toggled(bool)), SLOT(UpdatePreviews()));

  // Get the titles of the tags to put in the insert menu
  QStringList tag_titles = tags.keys();
  qStableSort(tag_titles);

  // Build the insert menu
  QMenu* tag_menu = new QMenu(this);
  QSignalMapper* tag_mapper = new QSignalMapper(this);
  for (const QString& title : tag_titles) {
    QAction* action = tag_menu->addAction(title, tag_mapper, SLOT(map()));
    tag_mapper->setMapping(action, tags[title]);
  }

  connect(tag_mapper, SIGNAL(mapped(QString)), SLOT(InsertTag(QString)));
  ui_->insert->setMenu(tag_menu);
}
开发者ID:Aceler,项目名称:Clementine,代码行数:59,代码来源:organisedialog.cpp


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