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


C++ QVariantList::begin方法代码示例

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


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

示例1: removeTracksFromSavedQueue

bool Player::removeTracksFromSavedQueue(const QString& SQid, const QVariantList& indexes, int containerUpdateID)
{
  if (m_player)
  {
    QString trackList;
    for (QVariantList::const_iterator it = indexes.begin(); it != indexes.end(); ++it)
    {
      if (it != indexes.begin())
        trackList.append(",");
      trackList.append(QString::number(it->value<int>()));
    }
    return m_player->ReorderTracksInSavedQueue(SQid.toUtf8().constData(), trackList.toUtf8().constData(), "", containerUpdateID);
  }
  return false;
}
开发者ID:gitter-badger,项目名称:noson-app,代码行数:15,代码来源:player.cpp

示例2:

QMap<QUrl,QUrl>* Fetcher::parseJson(QByteArray json)
{
    QMap<QUrl,QUrl>* urls = new QMap<QUrl,QUrl>();
    QJsonDocument jsonDoc = QJsonDocument::fromJson(json);

    QVariantMap  result = jsonDoc.toVariant().toMap();
    QVariantMap  responseData = (*result.find("responseData")).toMap();
    QVariantList resultList = (*responseData.find("results")).toList();
    QVariantMap  tmp;
    QVariant     tbUrl,imgUrl;
    QString      tbUrlString,imgUrlString;

    QVariantList::iterator it;
    for(it = resultList.begin() ; it != resultList.end() ; ++it)
    {
        tmp = (*it).toMap();

        tbUrl = (*tmp.find("tbUrl"));
        imgUrl = (*tmp.find("unescapedUrl"));
        tbUrlString = tbUrl.toString();
        imgUrlString = imgUrl.toString();
        urls->insert(QUrl(imgUrlString),QUrl(tbUrlString));
    }

    return urls;
}
开发者ID:Thra11,项目名称:RefImage,代码行数:26,代码来源:fetcher.cpp

示例3: getTorrents

/**
 * Returns all the torrents in JSON format.
 *
 * The return value is a JSON-formatted list of dictionaries.
 * The dictionary keys are:
 *   - "hash": Torrent hash
 *   - "name": Torrent name
 *   - "size": Torrent size
 *   - "progress: Torrent progress
 *   - "dlspeed": Torrent download speed
 *   - "upspeed": Torrent upload speed
 *   - "priority": Torrent priority (-1 if queuing is disabled)
 *   - "num_seeds": Torrent seeds connected to
 *   - "num_complete": Torrent seeds in the swarm
 *   - "num_leechs": Torrent leechers connected to
 *   - "num_incomplete": Torrent leechers in the swarm
 *   - "ratio": Torrent share ratio
 *   - "eta": Torrent ETA
 *   - "state": Torrent state
 *   - "seq_dl": Torrent sequential download state
 *   - "f_l_piece_prio": Torrent first last piece priority state
 *   - "force_start": Torrent force start state
 *   - "category": Torrent category
 */
QByteArray btjson::getTorrents(QString filter, QString category,
                               QString sortedColumn, bool reverse, int limit, int offset)
{
    QVariantList torrentList;
    TorrentFilter torrentFilter(filter, TorrentFilter::AnyHash, category);
    foreach (BitTorrent::TorrentHandle *const torrent, BitTorrent::Session::instance()->torrents()) {
        if (torrentFilter.match(torrent))
            torrentList.append(toMap(torrent));
    }

    std::sort(torrentList.begin(), torrentList.end(), QTorrentCompare(sortedColumn, reverse));
    int size = torrentList.size();
    // normalize offset
    if (offset < 0)
        offset = size + offset;
    if ((offset >= size) || (offset < 0))
        offset = 0;
    // normalize limit
    if (limit <= 0)
        limit = -1; // unlimited

    if ((limit > 0) || (offset > 0))
        return json::toJson(torrentList.mid(offset, limit));
    else
        return json::toJson(torrentList);
}
开发者ID:AlexTalker,项目名称:qBittorrent,代码行数:50,代码来源:btjson.cpp

示例4: notesChanged

void QmlProfilerEventsModelProxy::notesChanged(int typeIndex)
{
    const QmlProfilerNotesModel *notesModel = d->modelManager->notesModel();
    if (typeIndex == -1) {
        d->notes.clear();
        for (int noteId = 0; noteId < notesModel->count(); ++noteId) {
            int noteType = notesModel->typeId(noteId);
            if (noteType != -1) {
                QString &note = d->notes[noteType];
                if (note.isEmpty()) {
                    note = notesModel->text(noteId);
                } else {
                    note.append(QStringLiteral("\n")).append(notesModel->text(noteId));
                }
            }
        }
    } else {
        d->notes.remove(typeIndex);
        QVariantList changedNotes = notesModel->byTypeId(typeIndex);
        if (!changedNotes.isEmpty()) {
            QStringList newNotes;
            for (QVariantList::ConstIterator it = changedNotes.begin(); it !=  changedNotes.end();
                 ++it) {
                newNotes << notesModel->text(it->toInt());
            }
            d->notes[typeIndex] = newNotes.join(QStringLiteral("\n"));
        }
    }

    emit notesAvailable(typeIndex);
}
开发者ID:Gardenya,项目名称:qtcreator,代码行数:31,代码来源:qmlprofilereventsmodelproxy.cpp

示例5: loadNetworkReplyDataIntoDataBase

void WeatherDataSource::loadNetworkReplyDataIntoDataBase(QVariantList weatherData)
{
    // Iterate over all the items in the received data.
    QVariantList::Iterator item = weatherData.begin();

    // ValuesTable is a list of lists for adding a batch of data to the database.
    QVariantList valuesTable;

    // Update the data revision since we are adding new data to the data base.
    int revision = incrementRevision();

    while (item != weatherData.end()) {
        QVariantList entryValues;
        QVariantMap itemMap = (*item).toMap();
        QDate itemDate = QDate::fromString(itemMap["date"].toString(), "yyyy M d");
        itemMap["date"] = QVariant(itemDate.toString("yyyy-MM-dd"));

        // Store the retrieved values for adding to data base.
        entryValues << itemMap["city"];
        entryValues << itemMap["region"];
        entryValues << itemMap["templo"].toInt();
        entryValues << itemMap["temphi"].toInt();
        entryValues << itemMap["tempaverage"].toInt();
        entryValues << itemMap["icon"].toInt();
        entryValues << itemMap["date"].toString();
        entryValues << revision;
        valuesTable << QVariant::fromValue(entryValues);
        ++item;
    }

    // Insert the data into the data base here.
    QString query = "INSERT INTO weather (city, region, templo, temphi, tempaverage, icon, date, revision_id) VALUES (:city, :region, :templo, :temphi, :tempaverage, :icon, :date, :revision_id)";
    mSqlConnector->executeBatch(query, valuesTable);
}
开发者ID:BBKeeper,项目名称:Presentations,代码行数:34,代码来源:weatherdatasource.cpp

示例6: init

void QgsRelationReferenceWidget::init()
{
  if ( !mReadOnlySelector && mComboBox->count() == 0 && mReferencedLayer )
  {
    QApplication::setOverrideCursor( Qt::WaitCursor );

    QSet<QString> requestedAttrs;

    QgsVectorLayerCache* layerCache = new QgsVectorLayerCache( mReferencedLayer, 100000, this );

    if ( !mFilterFields.isEmpty() )
    {
      Q_FOREACH ( const QString& fieldName, mFilterFields )
      {
        QVariantList uniqueValues;
        int idx = mReferencedLayer->fields().lookupField( fieldName );
        QComboBox* cb = new QComboBox();
        cb->setProperty( "Field", fieldName );
        cb->setProperty( "FieldAlias", mReferencedLayer->attributeDisplayName( idx ) );
        mFilterComboBoxes << cb;
        mReferencedLayer->uniqueValues( idx, uniqueValues );
        cb->addItem( mReferencedLayer->attributeDisplayName( idx ) );
        QVariant nullValue = QSettings().value( QStringLiteral( "qgis/nullValue" ), "NULL" );
        cb->addItem( nullValue.toString(), QVariant( mReferencedLayer->fields().at( idx ).type() ) );

        qSort( uniqueValues.begin(), uniqueValues.end(), qgsVariantLessThan );
        Q_FOREACH ( const QVariant& v, uniqueValues )
        {
          cb->addItem( v.toString(), v );
        }
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:30,代码来源:qgsrelationreferencewidget.cpp

示例7: getId

int RatingsProcessor::getId(QString title, QString response) {
	int id;
	bool flagIn = false;
	bb::data::JsonDataAccess jda;
	QVariant vlist =  jda.loadFromBuffer(response);

	QVariantList list = vlist.toList();

	for (QList<QVariant>::iterator it = list.begin(); it != list.end(); it++) {
		QVariantMap map = it->toMap();
		QMapIterator<QString, QVariant> iw(map);
		while (iw.hasNext()) {
			iw.next();
			QVariantMap tw = iw.value().toMap();
			if (tw["title"] == title) {
				flagIn = true;
				id = tw["id"].toInt();
			}
		}
	}
	if (jda.hasError()) {
		id = 0;
		bb::data::DataAccessError error = jda.error();
		qDebug() << "JSON loading error: " << error.errorType() << ": "
				<< error.errorMessage();
	}
	if (!flagIn) {
		return 0;
	}
	return id;
}
开发者ID:QuickBlox,项目名称:quickblox-blackberry10-sdk,代码行数:31,代码来源:RatingsProcessor.cpp

示例8:

QVariantList Nuria::RestfulHttpNode::deepConvertList (QVariantList list) {
	for (auto it = list.begin (), end = list.end (); it != end; ++it) {
		*it = serializeVariant (*it);
	}
	
	return list;
	
}
开发者ID:NuriaProject,项目名称:Network,代码行数:8,代码来源:restfulhttpnode.cpp

示例9: loadFromMap

    /**
     * Load settings from the map. Existings settings will be overwritten.
     */
    void SettingsManager::loadFromMap(QVariantMap &map)
    {
        // 1. Load version
        _version = map.value("version").toString();

        // 2. Load UUID encoding
        int encoding = map.value("uuidEncoding").toInt();
        if (encoding > 3 || encoding < 0)
            encoding = 0;

        _uuidEncoding = (UUIDEncoding) encoding;


        // 3. Load view mode
        if (map.contains("viewMode")) {
            int viewMode = map.value("viewMode").toInt();
            if (viewMode > 2 || encoding < 0)
                viewMode = Custom; // Default View Mode
            _viewMode = (ViewMode) viewMode;
        } else {
            _viewMode = Custom; // Default View Mode
        }

        _autoExpand = map.contains("autoExpand") ?
            map.value("autoExpand").toBool() : true;

        _lineNumbers = map.contains("lineNumbers") ?
            map.value("lineNumbers").toBool() : true;

        // 4. Load TimeZone
        int timeZone = map.value("timeZone").toInt();
        if (timeZone > 1 || timeZone < 0)
            timeZone = 0;

        _timeZone = (SupportedTimes) timeZone;
        _loadMongoRcJs = map.value("loadMongoRcJs").toBool();
        _disableConnectionShortcuts = map.value("disableConnectionShortcuts").toBool();

        // Load Batch Size
        _batchSize = map.value("batchSize").toInt();
        if (_batchSize == 0)
            _batchSize = 50;
        _currentStyle = map.value("style").toString();
        if (_currentStyle.isEmpty()) {
            _currentStyle = AppStyle::StyleName;
        }

        // 5. Load connections
        _connections.clear();

        QVariantList list = map.value("connections").toList();
        for (QVariantList::iterator it = list.begin(); it != list.end(); ++it) {
            ConnectionSettings *record = new ConnectionSettings((*it).toMap());
            _connections.push_back(record);
        }
    }
开发者ID:Claercio,项目名称:robomongo,代码行数:59,代码来源:SettingsManager.cpp

示例10: addMultipleItemsToQueue

int Player::addMultipleItemsToQueue(const QVariantList& payloads)
{
  if (m_player)
  {
    std::vector<SONOS::DigitalItemPtr> items;
    for (QVariantList::const_iterator it = payloads.begin(); it != payloads.end(); ++it)
      items.push_back(it->value<SONOS::DigitalItemPtr>());
    return m_player->AddMultipleURIsToQueue(items);
  }
  return 0;
}
开发者ID:gitter-badger,项目名称:noson-app,代码行数:11,代码来源:player.cpp

示例11: uidHex

// For QML
QVariantList
RuleConditionNFC::getUidsQml() const {
    QVariantList uids;
    for (QSet<QByteArray>::const_iterator i = _uids.constBegin(); i != _uids.constEnd(); ++i) {
        QString uidHex(i->toHex());
        uids << uidHex; // QVariant::fromValue(*i);
    }
    qSort(uids.begin(), uids.end(), variantQStringLessThan);
    return uids;

}
开发者ID:ajalkane,项目名称:profilematic,代码行数:12,代码来源:ruleconditionnfc.cpp

示例12: jpush_setTags

void jpush_setTags(QVariantList tags)
{
    QString st;
    for(auto it = tags.begin(); it != tags.end(); ++it){
        st += (*it).toString() + ",";
    }
    st.remove(st.length()-1, 1);
    qDebug() << "******************* st=" << st;
    QAndroidJniObject jst = QAndroidJniObject::fromString(st);
    QAndroidJniObject::callStaticMethod<void>("qkit/KJPush","setTags","(Ljava/lang/String;)V", jst.object<jstring>());
}
开发者ID:zkelong,项目名称:QQuickProject,代码行数:11,代码来源:kjpush_android.cpp

示例13: fromQVariantList

void QueueResourcesList::fromQVariantList(QVariantList const& list)
{
   QVariantList::const_iterator iter;
   for (iter = list.begin(); iter != list.end(); ++iter) {
       QueueResources* queue(new QueueResources());
       if (queue->fromQVariant(*iter)) {
          append(queue);
       } else {
          delete queue;
       }
   }
}
开发者ID:autodataming,项目名称:IQmol,代码行数:12,代码来源:QueueResources.C

示例14: prettyList

QString MailAddress::prettyList(const QVariantList &list, FormattingMode mode)
{
    QStringList buf;
    for (QVariantList::const_iterator it = list.begin(); it != list.end(); ++it) {
        Q_ASSERT(it->type() == QVariant::StringList);
        QStringList item = it->toStringList();
        Q_ASSERT(item.size() == 4);
        MailAddress a(item[0], item[1], item[2], item[3]);
        buf << a.prettyName(mode);
    }
    return buf.join(QLatin1String(", "));
}
开发者ID:SpOOnman,项目名称:trojita,代码行数:12,代码来源:MailAddress.cpp

示例15: load

void SimpleClient::load(const QVariant& settings)
{
    const QVariantMap map = settings.toMap();

    if (map.contains("dialogs"))
    {
        const QVariantList list = map.value("dialogs").toList();

        for (QVariantList::const_iterator it = list.begin();
                it != list.end(); ++it)
        {
            const QVariantMap map = it->toMap();
            const QString operation = map["operation"].toString();

            if (!operation.isEmpty() && map.contains("value"))
            {
                // find the index
                unsigned int i = 0;
                const unsigned int count =
                    m_objref->interface()->operation_count();

                for (; i < count; i++)
                {
                    const char * current =
                            m_objref->interface()->get_reflective_by_index(
                                    i)->get_name();

                    if (operation == current) break;
                }

                // load its saved value
                if (i < count)
                {
                    getRequestDialog(i)->load(map.value("value"));
                }
            }
        }
    }

    if (map.contains("filtered_log"))
    {
        m_filteredLog->load(map["filtered_log"]);
    }

    if (map.contains("operations"))
    {
        // ensure created
        showOperationSequenceTool();

        m_seqTool->load(map["operations"]);
    }
}
开发者ID:catedrasaes-umu,项目名称:corbasim,代码行数:52,代码来源:SimpleClient.cpp


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