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


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

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


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

示例1: getDrawerByName

BorderDrawerInterface * BorderDrawersLoader::getDrawerFromSvg(QDomElement & drawerElement)
{
    QMap<QString,QString> properties;
    QDomNamedNodeMap attributes = drawerElement.attributes();
    for (int j = attributes.count()-1; j >= 0; --j)
    {
        QDomAttr attr = attributes.item(j).toAttr();
        if (attr.isNull())
            continue;
        properties.insert(attr.name(), attr.value());
    }
    QString drawerName = properties.take("name");
    if (!instance()->registeredDrawers().contains(drawerName))
        return 0;
    BorderDrawerInterface * drawer = getDrawerByName(drawerName);
    const QMetaObject * meta = drawer->metaObject();
    int count = meta->propertyCount();
    for (int i = 0; i < count; ++i)
    {
        QMetaProperty p = meta->property(i);
        QString value = properties.take(p.name());
        if (value.isEmpty())
            continue;
        p.write(drawer, QVariant(QByteArray::fromBase64(value.toAscii())));
    }
    return drawer;
}
开发者ID:coder89,项目名称:PhotoLayoutsEditor,代码行数:27,代码来源:BorderDrawersLoader.cpp

示例2: ShowRoute

void CRouteGraph::ShowRoute(const QList<SRouteEntry>& Entrys)
{
	CUInt128 MaxDistance;
	uint64 StartTime = ULLONG_MAX;
	uint64 MaxTime = 0;

	// Nodes BEGIN
	QMap<CUInt128, CRouteNode*> Nodes = m_Nodes;
	foreach(const SRouteEntry& Entry, Entrys)
	{
		CRouteNode* Node = Nodes.take(Entry.ID);
		if(!Node)
		{
			ASSERT(!m_Nodes.contains(Entry.ID));
			Node = new CRouteNode();
			m_Nodes.insert(Entry.ID, Node);
			scene()->addItem(Node);
			Node->setScale(m_ScaleFactor);
		}

		Node->SetColor(Entry.Color);
		Node->setToolTip(Entry.Tipp);

		if(Entry.Distance > MaxDistance)
			MaxDistance = Entry.Distance;

		if(Entry.Time > MaxTime)
			MaxTime = Entry.Time;
		if(Entry.Time < StartTime)
			StartTime = Entry.Time;
	}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:31,代码来源:RouteGraph.cpp

示例3: connect

// Fills in the various bits of information the tracker
// needs to keep around
void
MainWindow::setupTracker(Backend *newBug, QMap<QString, QString> info)
{
    newBug->setId(info["id"]);
    newBug->setName(info["name"]);
    newBug->setUsername(info["username"]);
    newBug->setPassword(info["password"]);
    newBug->setLastSync(info["last_sync"]);
    newBug->setVersion(info["version"]);
    if (!info["monitored_components"].isEmpty())
        newBug->setMonitorComponents(info["monitored_components"].split(","));
    connect(newBug, SIGNAL(bugsUpdated()),
            this, SLOT(bugsUpdated()));
    connect(newBug, SIGNAL(backendError(QString)),
            this, SLOT(backendError(QString)));

    // If this was called after the user used the Add Tracker window,
    // insert the data into the DB
    if (info["id"] == "-1")
    {
        info.take("id");
        info["auto_cache_comments"] = newBug->autoCacheComments();
        int tracker = SqlUtilities::simpleInsert("trackers", info);
        newBug->setId(QString("%1").arg(tracker));
        mSyncPosition = mBackendList.size() + 1;
        connect(newBug, SIGNAL(fieldsFound()),
                this, SLOT(fieldsChecked()));
        newBug->checkFields();
    }
    else
    {
        addTrackerToList(newBug, false);
    }
}
开发者ID:Entomologist,项目名称:entomologist,代码行数:36,代码来源:MainWindow.cpp

示例4: loadTemplateList

void AddJobDialog::loadTemplateList(void)
{
	ui->cbxTemplate->addItem(tr("<Default>"), QVariant::fromValue<const void*>(m_defaults));
	ui->cbxTemplate->setCurrentIndex(0);

	QMap<QString, OptionsModel*> templates = OptionsModel::loadAllTemplates(m_sysinfo);
	QStringList templateNames = templates.keys();
	templateNames.sort();

	for(QStringList::ConstIterator current = templateNames.constBegin(); current != templateNames.constEnd(); current++)
	{
		OptionsModel *currentTemplate = templates.take(*current);
		ui->cbxTemplate->addItem(*current, QVariant::fromValue<const void*>(currentTemplate));
		if(currentTemplate->equals(m_options))
		{
			ui->cbxTemplate->setCurrentIndex(ui->cbxTemplate->count() - 1);
		}
	}

	if((ui->cbxTemplate->currentIndex() == 0) && (!m_options->equals(m_defaults)))
	{
		qWarning("Not the default -> recently used!");
		ui->cbxTemplate->insertItem(1, tr("<Recently Used>"), QVariant::fromValue<const void*>(m_options));
		ui->cbxTemplate->setCurrentIndex(1);
	}
}
开发者ID:wyrover,项目名称:Simple-x264-Launcher,代码行数:26,代码来源:win_addJob.cpp

示例5: qt_input_remove

 static gboolean qt_input_remove(guint handle) {
         int toReturn = 0;
         QPurpleIONotifier *tmp = notifierMap.take(handle);
         if (!tmp->defaultConstructed) {
                 toReturn = 1;
                 delete tmp; }
         return toReturn;
 }
开发者ID:gatlin,项目名称:QPurple,代码行数:8,代码来源:qpurple.cpp

示例6: frameDoneCallback

void VS_CC frameDoneCallback(void *userData, const VSFrameRef *f, int n, VSNodeRef *, const char *errorMsg) {
    completedFrames++;

    if (f) {
        reorderMap.insert(n, f);
        while (reorderMap.contains(outputFrames)) {
            const VSFrameRef *frame = reorderMap.take(outputFrames);
            if (!outputError) {
				if (y4m) {
					if (!fwrite("FRAME\n", 6, 1, outFile)) {
						errorMessage = "Error: fwrite() call failed";
						totalFrames = requestedFrames;
						outputError = true;
					}
				}

				if (!outputError) {
					const VSFormat *fi = vsapi->getFrameFormat(frame);
					for (int p = 0; p < fi->numPlanes; p++) {
						int stride = vsapi->getStride(frame, p);
						const uint8_t *readPtr = vsapi->getReadPtr(frame, p);
						int rowSize = vsapi->getFrameWidth(frame, p) * fi->bytesPerSample;
						int height = vsapi->getFrameHeight(frame, p);
						for (int y = 0; y < height; y++) {
							if (!fwrite(readPtr, rowSize, 1, outFile)) {
								errorMessage = "Error: fwrite() call failed";
								totalFrames = requestedFrames;
								outputError = true;
								p = 100; // break out of the outer loop
								break;
							}
							readPtr += stride;
						}
					}
				}
			}
            vsapi->freeFrame(frame);
            outputFrames++;
        }
    } else {
        outputError = true;
        totalFrames = requestedFrames;
        if (errorMsg)
            errorMessage = QString("Error: Failed to retrieve frame ") + n + QString(" with error: ") + QString::fromUtf8(errorMsg);
        else
            errorMessage = QString("Error: Failed to retrieve frame ") + n;
    }

    if (requestedFrames < totalFrames) {
        vsapi->getFrameAsync(requestedFrames, node, frameDoneCallback, NULL);
        requestedFrames++;
    }

    if (totalFrames == completedFrames) {
        QMutexLocker lock(&mutex);
        condition.wakeOne();
    }
}
开发者ID:adworacz,项目名称:vapoursynth-archive,代码行数:58,代码来源:vspipe.cpp

示例7: addMark

void MarksDB::addMark(QString email,int lessonId, int mark)
{
    if (!markMap.contains(email))
    {
        markMap.insert(email,QMap<int,int>());
    }
    QMap<int, int> map = markMap.take(email);
    if (!map.contains(lessonId))
    {
        map.insert(lessonId,mark);
    }
    else
    {
        map.take(lessonId);
        map.insert(lessonId,mark);
    }
    markMap.insert(email,map);
}
开发者ID:soedar,项目名称:cs3249-project,代码行数:18,代码来源:MarksDB.cpp

示例8: qt_timer_remove

    static gboolean qt_timer_remove(guint handle) {
            int toReturn = 0;
            QPurpleTimer *tmp = timerMap.take(handle);
            if (!tmp->defaultConstructed) { // we removed something
                    toReturn = 1;
                    delete tmp; }

            return toReturn;
    }
开发者ID:gatlin,项目名称:QPurple,代码行数:9,代码来源:qpurple.cpp

示例9: unregisterShortcut

bool QxtGlobalShortcutPrivate::unregisterShortcut(quint32 nativeKey, quint32 nativeMods)
{
    Identifier id(nativeMods, nativeKey);
    if (!keyIDs.contains(id)) return false;

    EventHotKeyRef ref = keyRefs.take(keyIDs[id]);
    keyIDs.remove(id);
    return !UnregisterEventHotKey(ref);
}
开发者ID:Ack0,项目名称:CopyQ,代码行数:9,代码来源:qxtglobalshortcut_mac.cpp

示例10: Remove

/*!
 * \brief Universe::Remove Helper function
 * \param serverConnectionHandlerID the connection id of the server
 * \param clientID the client id on the current tab
 */
void Universe::Remove(uint64 serverConnectionHandlerID, anyID clientID)
{
    if (!(UniverseMap.contains(serverConnectionHandlerID)))
        return;

    QMap<anyID,TsVR*>* ConnectionHandlerUniverse = UniverseMap.value(serverConnectionHandlerID);
    if (!(ConnectionHandlerUniverse->contains(clientID)))
        return;

    delete ConnectionHandlerUniverse->take(clientID);
}
开发者ID:AngryJoker,项目名称:CrossTalk,代码行数:16,代码来源:universe.cpp

示例11: AddAndroidHosts

void PersistantConfig::AddAndroidHosts()
{
  QMap<rdcstr, RemoteHost *> oldHosts;
  for(int i = RemoteHosts.count() - 1; i >= 0; i--)
  {
    if(RemoteHosts[i]->IsADB())
    {
      RemoteHost *host = RemoteHosts.takeAt(i);
      oldHosts[host->hostname] = host;
    }
  }

  QString androidSDKPath = QFile::exists(Android_SDKPath) ? QString(Android_SDKPath) : QString();

  SetConfigSetting("androidSDKPath", androidSDKPath);

  QString androidJDKPath = QFile::exists(Android_JDKPath) ? QString(Android_JDKPath) : QString();

  SetConfigSetting("androidJDKPath", androidJDKPath);

  SetConfigSetting("MaxConnectTimeout", QString::number(Android_MaxConnectTimeout));

  rdcstr androidHosts;
  RENDERDOC_EnumerateAndroidDevices(&androidHosts);
  for(const QString &hostName :
      QString(androidHosts).split(QLatin1Char(','), QString::SkipEmptyParts))
  {
    RemoteHost *host = NULL;

    if(oldHosts.contains(hostName))
      host = oldHosts.take(hostName);
    else
      host = new RemoteHost();

    host->hostname = hostName;
    rdcstr friendly;
    RENDERDOC_GetAndroidFriendlyName(hostName.toUtf8().data(), friendly);
    host->friendlyName = friendly;
    // Just a command to display in the GUI and allow Launch() to be called.
    host->runCommand = lit("Automatically handled");
    RemoteHosts.push_back(host);
  }

  // delete any leftovers
  QMapIterator<rdcstr, RemoteHost *> i(oldHosts);
  while(i.hasNext())
  {
    i.next();
    delete i.value();
  }
}
开发者ID:cgmb,项目名称:renderdoc,代码行数:51,代码来源:PersistantConfig.cpp

示例12: set_write_handler

void set_write_handler(int fd, void (*cb)(void *opaque), void *opaque)
{
    if (gWriteNotifiers.contains(fd)) {
        QSocketNotifier *notifier = gWriteNotifiers.take(fd);
        notifier->setEnabled(false);
        delete notifier;
    }

    if (cb == nullptr) {
        return;
    }

    QSocketNotifier *notifier = new QSocketNotifier(fd, QSocketNotifier::Write);
    QObject::connect(notifier, &QSocketNotifier::activated,
                     std::bind(cb, opaque) );
}
开发者ID:Ivan1234,项目名称:qemacs,代码行数:16,代码来源:qt.cpp

示例13: SServer

void CP2PServers::SyncServers(const QVariantMap& Response)
{
	QMap<QString, SServer*> OldServers = m_Servers;

	foreach (const QVariant& vServer,Response["Servers"].toList())
	{
		QVariantMap Server = vServer.toMap();

		QString Url = Server["Url"].toString();

		SServer* pServer = OldServers.take(Url);
		if(!pServer)
		{
			pServer = new SServer();
			pServer->pItem = new QTreeWidgetItem();
			m_pServerTree->addTopLevelItem(pServer->pItem);

			pServer->pItem->setText(eUrl, Url);

			m_Servers.insert(Url, pServer);
		}

		QFont Font = pServer->pItem->font(eUrl);
		if(Font.bold() != Server["IsStatic"].toBool())
		{
			Font.setBold(Server["IsStatic"].toBool());
			pServer->pItem->setFont(eUrl, Font);
		}

		pServer->pItem->setText(eName, Server["Name"].toString());
		pServer->pItem->setData(eName, Qt::UserRole, Server["IsStatic"]);
		pServer->pItem->setText(eVersion, Server["Version"].toString());
		pServer->pItem->setText(eStatus, Server["Status"].toString());
		pServer->pItem->setData(eStatus, Qt::UserRole, Server["Status"]);
		pServer->pItem->setText(eUsers, Server["UserCount"].toString() + "(" + Server["LowIDCount"].toString() + ")/" + Server["UserLimit"].toString());
		pServer->pItem->setText(eFiles, Server["FileCount"].toString() + "|" + Server["HardLimit"].toString() + "(" + Server["SoftLimit"].toString() + ")");
		pServer->pItem->setText(eDescription, Server["Description"].toString());
	}

	foreach(SServer* pServer, OldServers)
	{
		m_Servers.remove(OldServers.key(pServer));
		delete pServer->pItem;
		delete pServer;
	}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:45,代码来源:P2PServers.cpp

示例14: set_branch

void set_branch( const QList< uint * > &touching, const BillonTpl< tlabel > *labelSkel, const BillonTpl< tlabelbranch > *labelBranch, 
                 QMap< tlabelbranch, tlabel > &NewLabelBranch, const QList< tlabel > &Labels, QMap< tlabel, QList<tlabel> > &edges ) {
	QList< uint * >::const_iterator iterVoxel = touching.begin(),
	                                iterVoxelEnd = touching.end() ;
	bool bDiscard ;
	QList< tlabelbranch > bridges ;
	while ( iterVoxel != iterVoxelEnd ) {
		tlabelbranch idBranch = (*labelBranch)( (*iterVoxel)[1], (*iterVoxel)[0], (*iterVoxel)[2] ) ;
		tlabel idComp = (*labelSkel)( (*iterVoxel)[1], (*iterVoxel)[0], (*iterVoxel)[2] ) ;
		bDiscard = false ;
		if ( !Labels.isEmpty() ) {
			bDiscard = ( !Labels.contains( idComp ) );
		}
		if ( !bDiscard ) {
			if ( !NewLabelBranch.contains( idBranch ) )
				NewLabelBranch.insert( idBranch, idComp ) ;
			else if (NewLabelBranch[idBranch] != idComp ) {
				bridges.append( idBranch ) ;
				if ( !edges.contains( idComp ) ) edges.insert( idComp, QList<tlabel>() ) ;
				if ( !edges.contains( NewLabelBranch[idBranch] ) ) edges.insert( NewLabelBranch[idBranch], QList<tlabel>() ) ;
				edges[ idComp ].append( NewLabelBranch[idBranch] ) ;
				//edges[ idComp ].append( idBranch ) ;
				edges[ NewLabelBranch[idBranch] ].append( idComp ) ;
				//edges[ NewLabelBranch[idBranch] ].append( idBranch ) ; /// it is this value that is the edge between the two
			}
		} else if ( NewLabelBranch.contains( idBranch ) ) {
			bridges.append( idBranch ) ;
		}
		iterVoxel++ ;
	}
	/// component that get their identifier in bridges are connected to at least two components
	qSort( bridges.begin(), bridges.end(), qLess< tlabelbranch >() ) ;
	while ( !bridges.isEmpty() ) {
		NewLabelBranch.take( bridges.takeFirst() ) ;
	}
	
	for ( QMap<tlabel,QList<tlabel> >::ConstIterator e_source_it = edges.begin() ; e_source_it != edges.end() ; e_source_it++ ) {
		std::cout<<(int)e_source_it.key()<<" connected to ";
		for ( QList<tlabel>::ConstIterator e_target_it = e_source_it.value().begin() ; e_target_it != e_source_it.value().end() ; e_target_it++ )
			std::cout<<(int)*e_target_it<<" " ;
		std::cout<<std::endl;
	}
	
}
开发者ID:hlocteau,项目名称:anthill,代码行数:44,代码来源:catchskel.cpp

示例15: deleteLesson

void MarksDB::deleteLesson(int lessonId)
{
    QList<QString> listStudents = markMap.uniqueKeys();

    for (int i=0; i<listStudents.size(); i++)
    {
        QString name = listStudents.at(i);

        QMap<int,int> tempMap = markMap.take(name);

        if (tempMap.contains(lessonId))
        {
            tempMap.remove(lessonId);
        }
        if (tempMap.size() > 0)
        {
            markMap.insert(name,tempMap);
        }
    }
}
开发者ID:soedar,项目名称:cs3249-project,代码行数:20,代码来源:MarksDB.cpp


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