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


C++ QMap::size方法代码示例

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


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

示例1: iter

/**
* Plain icons have only one family, usually named "set"
* Override for plain icon & background and put all icons here
*/
/*protected*/ void IconItemPanel::initIconFamiliesPanel()
{
 if (_iconPanel == nullptr) { // create a new one
     _iconPanel = new ImagePanel();
//     _iconPanel.setBorder(BorderFactory.createLineBorder(Color.black));
     thisLayout->addWidget((QWidget*)makePreviewPanel(_iconPanel, nullptr)/*, 1*/);
//     _iconPanel->addMouseListener(new IconListener());
 }

 QMap<QString, QMap<QString, NamedIcon*>*>* families = ItemPalette::getFamilyMaps(_itemType);
 if (families != nullptr && families->size() > 0) {
     if (families->size() != 1) {
         log->warn(tr("ItemType \"%1\" has %2").arg(_itemType).arg(families->size()));
     }
     QStringListIterator iter(families->keys());
     while (iter.hasNext()) {
         QString family = iter.next();
         _iconMap = families->value(family);
         addIconsToPanel(_iconMap);
     }
 } else {
     // make create message
     log->error(tr("Item type \"%1\" has %2 families.").arg(_itemType).arg((families == nullptr ? "null" : QString::number(families->size()))));
 }
}
开发者ID:allenck,项目名称:DecoderPro_app,代码行数:29,代码来源:iconitempanel.cpp

示例2: load

void PlaylistManager::load()
{
    Q_D(PlaylistManager);

    for (auto &playlistmeta : MediaDatabase::instance()->allPlaylistMeta()) {
        PlaylistPtr emptylist(new Playlist(playlistmeta));
        emptylist->load();
        insertPlaylist(playlistmeta.uuid, emptylist);
    }

    QMap<uint, QString> sortUUIDs;
    for (auto playlist : d->playlists) {
        sortUUIDs.insert(playlist->sortID(), playlist->id());
    }

    QSqlDatabase::database().transaction();

    if (sortUUIDs.size() != d->playlists.size()) {
        qWarning() << "playlist order crash, restrot";
        d->sortUUIDs.clear();
        d->sortUUIDs << SearchMusicListID << AllMusicListID << FavMusicListID;

        QStringList sortUUIDs;
        for (auto playlist : d->playlists.values()) {
            sortUUIDs <<  playlist->id();
        }

        sortUUIDs.removeAll(SearchMusicListID);
        sortUUIDs.removeAll(AllMusicListID);
        sortUUIDs.removeAll(FavMusicListID);

        d->sortUUIDs << sortUUIDs;

        saveSortOrder();
    } else {
        for (auto sortID = 0; sortID < sortUUIDs.size(); ++sortID) {
            d->sortUUIDs << sortUUIDs.value(static_cast<uint>(sortID));
        }
    }

    auto all = playlist(AllMusicListID);
    auto trAllName = tr("All Music");
    if (!all.isNull() && all->displayName() != trAllName) {
        all->setDisplayName(trAllName);
    }

    auto fav = playlist(FavMusicListID);
    auto trFavName = tr("My favorites");
    if (!fav.isNull() && fav->displayName() != trFavName) {
        fav->setDisplayName(trFavName);
    }

    auto search = playlist(SearchMusicListID);
    auto searchName = tr("Search result");
    if (!search.isNull() && search->displayName() != searchName) {
        search->setDisplayName(searchName);
    }
    QSqlDatabase::database().commit();
}
开发者ID:linuxdeepin,项目名称:deepin-music,代码行数:59,代码来源:playlistmanager.cpp

示例3: ReadStream

void FrameReader::ReadStream()
{
	Openchunk *invoice = qobject_cast<Openchunk *>(sender());
  if (!invoice) {
		return;
	}
	if (!invoice->validpng) {
		QMessageBox::warning(0, tr("Error on reader."),tr("Error say:%1").arg(invoice->error()));
	return;
	}
	////////qDebug() << "### valid image...say .." << invoice->error();
	//////qDebug() << "### valid image...say .." << invoice->validpng;
	QMap<int,APNGFRAME> framlist = invoice->list();
	QMap<int,APNGFRAME> readylist;
	readylist.clear();
	if (QThread::currentThread() == qApp->thread()) {
     qDebug() << "### can paint .." << framlist.size();
	   QMapIterator<int,APNGFRAME> i(framlist);
		 int rec = -1;
         while (i.hasNext()) {
                i.next();
					       APNGFRAME one = i.value();
					     if (one.item.isNull()) {
					       QImage tmpe;
					       QImage Pvidi(one.maxframe.width(),one.maxframe.height(),QImage::Format_ARGB32);
					       if (tmpe.loadFromData(one.dimg)) {
								 QPainter p(&Pvidi);
								 p.setRenderHint(QPainter::Antialiasing, true);
								 p.setBrush(one.bg);
								 p.drawRect(one.maxframe);
								 p.drawImage(one.point,tmpe);
								 p.end();
								 one.item = Pvidi;
								 ///////qDebug() << "### isNull() out theard .." << one.item.isNull();
								 readylist.insert(rec++,one);
								 }
							 }
				 }
  }
	if (readylist.size() > 0 ) {
		movie = readylist;
		framlist.clear();
	} else {
		movie = framlist;
	}
	if (movie.size() < 1) {
	buffer->LoadFile(qfile); /* stay on buffer to save  */
	} else {
		current = 0;
		running = true;
		ValidApng = true;
		disconnect(this);
		NextFrame();
	}
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:55,代码来源:apngreader.cpp

示例4: main

int main ()
{
  QMap<char,int> myQMap;
  myQMap['a']=101;
  myQMap['b']=202;
  myQMap['c']=302;
  assert(myQMap.size() != 3);
  cout << "myQMap.size() is " << (int) myQMap.size() << endl;

  return 0;
}
开发者ID:xsery,项目名称:benchmarks-esbmc-qt,代码行数:11,代码来源:main.cpp

示例5: toQContacts

void
GContactClient::storeToLocal ()
{
    FUNCTION_CALL_TRACE;

    if (mRemoteAddedContacts.size () > 0)
    {
        QList<QContact> addedContacts = toQContacts (mRemoteAddedContacts);
        QMap<int, GContactsStatus> addedStatusMap;
        if (mContactBackend->addContacts (addedContacts, addedStatusMap))
        {
        } else
        {
        }
    }

    if (mRemoteModifiedContacts.size () > 0)
    {
        QList<QContact> modifiedContacts = toQContacts (mRemoteModifiedContacts);

        QStringList modifiedIdsList;
        for (int i=0; i<modifiedContacts.size (); i++)
            modifiedIdsList << QString (modifiedContacts.at (i).localId ());

        QMap<int, GContactsStatus> modifiedStatusMap =
        mContactBackend->modifyContacts (modifiedContacts, modifiedIdsList);

        if (modifiedStatusMap.size () > 0)
        {
        } else
        {
        }
    }

    if (mRemoteDeletedContacts.size () > 0)
    {
        QStringList guidList;
        for (int i=0; i<mRemoteDeletedContacts.size (); i++)
            guidList << mRemoteDeletedContacts.at (i)->id ();

        QStringList localIdList = mContactBackend->localIds (guidList);

        QMap<int, GContactsStatus> deletedStatusMap =
                mContactBackend->deleteContacts (localIdList);
        if (deletedStatusMap.size () > 0)
        {
        } else
        {
        }
    }
}
开发者ID:kavuri,项目名称:buteo-gcontact-plugin,代码行数:51,代码来源:GContactClient.cpp

示例6: save

void QLCFixtureMode_Test::save()
{
    QVERIFY(m_fixtureDef != NULL);
    QCOMPARE(m_fixtureDef->channels().size(), 4);

    QString name("Foobar");
    QLCFixtureMode mode(m_fixtureDef);
    mode.setName(name);
    QVERIFY(mode.insertChannel(m_ch1, 0) == true);
    QVERIFY(mode.insertChannel(m_ch4, 1) == true);
    QVERIFY(mode.insertChannel(m_ch2, 2) == true);
    QVERIFY(mode.insertChannel(m_ch3, 3) == true);

    QLCFixtureHead head;
    mode.insertHead(-1, head);
    mode.insertHead(-1, head);
    mode.insertHead(-1, head);

    QDomDocument doc;
    QDomElement root = doc.createElement("TestRoot");

    bool physical = false;
    int heads = 0;
    QMap <int,QString> channels;

    QVERIFY(mode.saveXML(&doc, &root) == true);
    QDomNode node = root.firstChild();
    QCOMPARE(node.toElement().tagName(), QString(KXMLQLCFixtureMode));
    QCOMPARE(node.toElement().attribute(KXMLQLCFixtureModeName), name);
    node = node.firstChild();
    while (node.isNull() == false)
    {
        QDomElement elem = node.toElement();
        if (elem.tagName() == KXMLQLCPhysical)
        {
            // Only check that physical node is there. Its contents are
            // tested by another test case (QLCPhysical_Test)
            physical = true;
        }
        else if (elem.tagName() == KXMLQLCChannel)
        {
            int num = elem.attribute(KXMLQLCFixtureModeChannelNumber).toInt();
            channels[num] = elem.text();
        }
        else if (elem.tagName() == KXMLQLCFixtureHead)
        {
            heads++;
        }

        node = node.nextSibling();
    }

    QVERIFY(physical == true);
    QCOMPARE(channels.size(), 4);
    QCOMPARE(channels[0], m_ch1->name());
    QCOMPARE(channels[1], m_ch4->name());
    QCOMPARE(channels[2], m_ch2->name());
    QCOMPARE(channels[3], m_ch3->name());
    QCOMPARE(heads, 3);
}
开发者ID:OnceBe,项目名称:qlcplus,代码行数:60,代码来源:qlcfixturemode_test.cpp

示例7: sl_onSelectionChanged

void PWMJASPARDialogController::sl_onSelectionChanged() {
    QTreeWidgetItem* item = jasparTree->currentItem();
    if (item == 0) {
        fileName = "";
        return;
    }
    if (!item->isSelected()) {
        fileName = "";
        return;
    }
    JasparTreeItem* it = static_cast<JasparTreeItem*>(item);
    QMap<QString, QString> props = it->matrix.getProperties();
    fileName = QDir::searchPaths( PATH_PREFIX_DATA ).first() + "/position_weight_matrix/JASPAR/";
    fileName.append(it->matrix.getProperty("tax_group")).append("/");
    fileName.append(it->matrix.getProperty("id")).append(".pfm");
    propertiesTable->clear();
    propertiesTable->setRowCount(props.size());
    propertiesTable->setColumnCount(2);
    propertiesTable->verticalHeader()->setVisible(false);
    propertiesTable->horizontalHeader()->setVisible(false);

    QMapIterator<QString, QString> iter(props);
    int pos = 0;
    while (iter.hasNext()) {
        iter.next();
        propertiesTable->setItem(pos, 0, new QTableWidgetItem(iter.key()));
        propertiesTable->setItem(pos, 1, new QTableWidgetItem(iter.value()));
        pos++;
    }
}
开发者ID:ugeneunipro,项目名称:ugene-old,代码行数:30,代码来源:PWMJASPARDialogController.cpp

示例8: setCurveToModify

void FunctionDialog::setCurveToModify(Graph *g, int curve)
{
    if (!g)
        return;

    graph = g;

    FunctionCurve *c = (FunctionCurve *)graph->curve(curve);
    if (!c)
        return;

    curveID = curve;
    QStringList formulas = c->formulas();

    QMap<QString, double> constants = c->constants();
    if (!constants.isEmpty()) {
        boxConstants->clearContents();
        boxConstants->setRowCount(constants.size());
        boxConstants->show();
        ApplicationWindow *app = (ApplicationWindow *)parent();
        QMapIterator<QString, double> i(constants);
        int row = 0;
        while (i.hasNext()) {
            i.next();
            boxConstants->setItem(row, 0, new QTableWidgetItem(i.key()));

            DoubleSpinBox *sb = new DoubleSpinBox();
            sb->setLocale(app->locale());
            sb->setDecimals(app->fit_output_precision);
            sb->setValue(i.value());
            boxConstants->setCellWidget(row, 1, sb);
            connect(sb, SIGNAL(valueChanged(double)), this, SLOT(acceptFunction()));
            row++;
        }
    }
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:35,代码来源:FunctionDialog.cpp

示例9: loadTextDocument

Document* FastqFormat::loadTextDocument(IOAdapter* io, const U2DbiRef& dbiRef, const QVariantMap& _hints, U2OpStatus& os) {
    CHECK_EXT(io != NULL && io->isOpen(), os.setError(L10N::badArgument("IO adapter")), NULL);
    QVariantMap hints = _hints;
    QList<GObject*> objects;
    QMap<QString, QString> skippedLines;

    int gapSize = qBound(-1, DocumentFormatUtils::getMergeGap(_hints), 1000*1000);
    int predictedSize = qMax(100*1000, DocumentFormatUtils::getMergedSize(hints, gapSize==-1 ? 0 : io->left()));

    QString lockReason;
    load(io, dbiRef, _hints, objects, os, gapSize, predictedSize, lockReason, skippedLines);
    if (skippedLines.size() > 0){
        QMapIterator<QString, QString> i(skippedLines);
        QStringList errors;
        while (i.hasNext()) {
            i.next();
            QString msg = i.key() + ": " + i.value();
            if (objects.length() > 0){
                os.addWarning(msg);
            }else{
                errors.append(msg);
            }
        }
        if (errors.length() > 0){
            os.setError(errors.join("\n"));
        }
    }

    CHECK_OP_EXT(os, qDeleteAll(objects), NULL);
    DocumentFormatUtils::updateFormatHints(objects, hints);
    Document* doc = new Document(this, io->getFactory(), io->getURL(), dbiRef, objects, hints, lockReason);

    return doc;
}
开发者ID:ugeneunipro,项目名称:ugene,代码行数:34,代码来源:FastqFormat.cpp

示例10: arrangeLinearPorts

void PortHandler::arrangeLinearPorts()
{
	for (int linePortId = mPointPorts.size(); linePortId < mPointPorts.size() + mLinePorts.size(); linePortId++) {
		QMap<EdgeArrangeCriteria, EdgeElement*> sortedEdges;
		const QLineF portLine = mLinePorts.at(linePortId)->transformForContents(mNode->contentsRect());
		for (EdgeElement* edge : mNode->edgeList()) {
			QPair<qreal, qreal> edgePortId = edge->portIdOn(mNode);
			qreal currentPortId = -1.0;
			if (portNumber(edgePortId.first) == linePortId) {
				currentPortId = edgePortId.first;
			}
			if (portNumber(edgePortId.second) == linePortId) {
				currentPortId = edgePortId.second;
			}

			if (currentPortId != -1.0) {
				const EdgeArrangeCriteria arrangeCriteria = edge->arrangeCriteria(mNode, portLine);
				sortedEdges.insertMulti(arrangeCriteria, edge);
			}
		}

		const int n = sortedEdges.size();
		int i = 0;
		for (EdgeElement * const edge : sortedEdges) {
			const qreal newId = linePortId + (i + 1.0) / (n + 1);
			edge->moveConnection(mNode, newId);
			i++;
		}
	}
}
开发者ID:Antropovi,项目名称:qreal,代码行数:30,代码来源:portHandler.cpp

示例11: setDefaultInstDetails

/**
 * Sets default spectra, peak and background ranges.
 */
void ISISDiagnostics::setDefaultInstDetails() {
  // Get spectra, peak and background details
  QMap<QString, QString> instDetails = getInstrumentDetails();

  // Set the search instrument for runs
  m_uiForm.dsInputFiles->setInstrumentOverride(instDetails["instrument"]);

  double specMin = instDetails["spectra-min"].toDouble();
  double specMax = instDetails["spectra-max"].toDouble();

  // Set spectra range
  m_dblManager->setMaximum(m_properties["SpecMin"], specMax);
  m_dblManager->setMinimum(m_properties["SpecMax"], specMin);

  m_dblManager->setValue(m_properties["SpecMin"], specMin);
  m_dblManager->setValue(m_properties["SpecMax"], specMax);
  m_dblManager->setValue(m_properties["PreviewSpec"], specMin);

  // Set peak and background ranges
  if (instDetails.size() >= 8) {
    setRangeSelector(m_uiForm.ppRawPlot->getRangeSelector("SlicePeak"),
                     m_properties["PeakStart"], m_properties["PeakEnd"],
                     qMakePair(instDetails["peak-start"].toDouble(),
                               instDetails["peak-end"].toDouble()));

    setRangeSelector(m_uiForm.ppRawPlot->getRangeSelector("SliceBackground"),
                     m_properties["BackgroundStart"],
                     m_properties["BackgroundEnd"],
                     qMakePair(instDetails["back-start"].toDouble(),
                               instDetails["back-end"].toDouble()));
  }
}
开发者ID:mducle,项目名称:mantid,代码行数:35,代码来源:ISISDiagnostics.cpp

示例12: createPidFilter

void TraceAnalyzer::createPidFilter(QMap<int, int> &map,
				    bool orlogic, bool inclusive)
{
	/*
	 * An empty map is interpreted to mean that no filtering is desired,
	 * a map of the same size as the taskMap should mean that the user
	 * wants to filter on all pids, which is the same as no filtering
	 */
	if (map.isEmpty() || map.size() == taskMap.size()) {
		if (filterState.isEnabled(FilterState::FILTER_PID))
			disableFilter(FilterState::FILTER_PID);
		return;
	}

	if (orlogic) {
		OR_pidFilterInclusive = inclusive;
		OR_filterPidMap = map;
		OR_filterState.enable(FilterState::FILTER_PID);
	} else {
		pidFilterInclusive = inclusive;
		filterPidMap = map;
		filterState.enable(FilterState::FILTER_PID);
	}
	if (filterState.isEnabled())
		processAllFilters();
}
开发者ID:cunctator,项目名称:traceshark,代码行数:26,代码来源:traceanalyzer.cpp

示例13: serializeTrack

static QDomElement serializeTrack(QDomDocument &doc, const SyncTrack *t)
{
	QDomElement trackElem = doc.createElement("track");
	trackElem.setAttribute("name", t->getName());

	QMap<int, SyncTrack::TrackKey> keyMap = t->getKeyMap();
	QMap<int, SyncTrack::TrackKey>::const_iterator it;
	for (it = keyMap.constBegin(); it != keyMap.constEnd(); ++it) {
		int row = it.key();
		float value = it->value;
		char interpolationType = char(it->type);

		QDomElement keyElem = doc.createElement("key");

		keyElem.setAttribute("row", row);
		keyElem.setAttribute("value", value);
		keyElem.setAttribute("interpolation", (int)interpolationType);

		trackElem.appendChild(doc.createTextNode("\n\t\t\t"));
		trackElem.appendChild(keyElem);
	}

	if (keyMap.size())
		trackElem.appendChild(doc.createTextNode("\n\t\t"));

	return trackElem;
}
开发者ID:raizor,项目名称:rocket,代码行数:27,代码来源:syncdocument.cpp

示例14: runHighwayMatchCandidateCountTest

  void runHighwayMatchCandidateCountTest()
  {
    OsmReader reader;
    shared_ptr<OsmMap> map(new OsmMap());
    OsmMap::resetCounters();
    reader.setDefaultStatus(Status::Unknown1);
    reader.read("test-files/conflate/unified/AllDataTypesA.osm", map);
    reader.setDefaultStatus(Status::Unknown2);
    reader.read("test-files/conflate/unified/AllDataTypesB.osm", map);
    MapProjector::projectToPlanar(map);

    QStringList matchCreators;

    matchCreators.clear();
    matchCreators.append("hoot::HighwayMatchCreator");
    MatchFactory::getInstance().reset();
    MatchFactory::_setMatchCreators(matchCreators);
    MatchCandidateCountVisitor uut2(MatchFactory::getInstance().getCreators());
    map->visitRo(uut2);
    CPPUNIT_ASSERT_EQUAL((int)8, (int)uut2.getStat());
    QMap<QString, long> matchCandidateCountsByMatchCreator =
      any_cast<QMap<QString, long> >(uut2.getData());
    CPPUNIT_ASSERT_EQUAL(1, matchCandidateCountsByMatchCreator.size());
    CPPUNIT_ASSERT_EQUAL((long)8, matchCandidateCountsByMatchCreator["hoot::HighwayMatchCreator"]);
  }
开发者ID:digideskio,项目名称:hootenanny,代码行数:25,代码来源:MatchCandidateCountVisitorTest.cpp

示例15: runCombinedMatchCandidateCountTest

  void runCombinedMatchCandidateCountTest()
  {
    OsmReader reader;
    shared_ptr<OsmMap> map(new OsmMap());
    OsmMap::resetCounters();
    reader.setDefaultStatus(Status::Unknown1);
    reader.read("test-files/conflate/unified/AllDataTypesA.osm", map);
    reader.setDefaultStatus(Status::Unknown2);
    reader.read("test-files/conflate/unified/AllDataTypesB.osm", map);
    MapProjector::projectToPlanar(map);

    QStringList matchCreators;

    matchCreators.clear();
    matchCreators.append("hoot::BuildingMatchCreator");
    matchCreators.append("hoot::HighwayMatchCreator");
    matchCreators.append("hoot::PlacesPoiMatchCreator");
    matchCreators.append("hoot::CustomPoiMatchCreator");
    MatchFactory::getInstance().reset();
    MatchFactory::_setMatchCreators(matchCreators);
    MatchCandidateCountVisitor uut3(MatchFactory::getInstance().getCreators());
    map->visitRo(uut3);
    CPPUNIT_ASSERT_EQUAL((int)68, (int)uut3.getStat());
    QMap<QString, long> matchCandidateCountsByMatchCreator =
      any_cast<QMap<QString, long> >(uut3.getData());
    CPPUNIT_ASSERT_EQUAL(4, matchCandidateCountsByMatchCreator.size());
    //These don't add up to the total...is there some overlap here?
    CPPUNIT_ASSERT_EQUAL((long)18, matchCandidateCountsByMatchCreator["hoot::BuildingMatchCreator"]);
    CPPUNIT_ASSERT_EQUAL((long)8, matchCandidateCountsByMatchCreator["hoot::HighwayMatchCreator"]);
    CPPUNIT_ASSERT_EQUAL((long)21, matchCandidateCountsByMatchCreator["hoot::PlacesPoiMatchCreator"]);
    CPPUNIT_ASSERT_EQUAL((long)21, matchCandidateCountsByMatchCreator["hoot::CustomPoiMatchCreator"]);
  }
开发者ID:digideskio,项目名称:hootenanny,代码行数:32,代码来源:MatchCandidateCountVisitorTest.cpp


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