本文整理汇总了C++中QMultiHash::keys方法的典型用法代码示例。如果您正苦于以下问题:C++ QMultiHash::keys方法的具体用法?C++ QMultiHash::keys怎么用?C++ QMultiHash::keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMultiHash
的用法示例。
在下文中一共展示了QMultiHash::keys方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: offlineMessageManagerReply
/*!
* \brief The OfflineMessageManager::offlineMessageManagerReply method parse an offline message query an return response
* \param iqXML
* \param iqFrom
* \return QByteArray
*/
QByteArray OfflineMessageManager::offlineMessageManagerReply(QDomDocument document, QString iqFrom)
{
QString id = document.documentElement().attribute("id", Utils::generateId());
QString offlineFirstChildTagName = document.documentElement().firstChildElement().firstChildElement().tagName();
if (offlineFirstChildTagName == "fetch")
{
QMultiHash<QString, QByteArray> messageList = getAllOfflineMessage(Utils::getBareJid(iqFrom));
QList<QString> keyList = messageList.keys();
QByteArray allMessages;
foreach (QString key, keyList)
{
QDomDocument document;
document.setContent(messageList.value(key));
QDomElement offlineElement = document.createElement("offline");
offlineElement.setAttribute("xmlns", "http://jabber.org/protocol/offline");
QDomElement item = document.createElement("item");
item.setAttribute("node", key);
offlineElement.appendChild(item);
document.documentElement().appendChild(offlineElement);
allMessages += document.toByteArray();
}
示例2: setFixtureSelection
void ContextManager::setFixtureSelection(quint32 fxID, bool enable)
{
if (m_selectedFixtures.contains(fxID))
{
if (enable == false)
m_selectedFixtures.removeAll(fxID);
else
return;
}
else
{
if (enable)
m_selectedFixtures.append(fxID);
else
return;
}
if (m_DMXView->isEnabled())
m_DMXView->updateFixtureSelection(fxID, enable);
if (m_2DView->isEnabled())
m_2DView->updateFixtureSelection(fxID, enable);
QMultiHash<int, SceneValue> channels = m_fixtureManager->setFixtureCapabilities(fxID, enable);
if(channels.keys().isEmpty())
return;
qDebug() << "[ContextManager] found" << channels.keys().count() << "capabilities";
QHashIterator<int, SceneValue>it(channels);
while(it.hasNext())
{
it.next();
quint32 chType = it.key();
SceneValue sv = it.value();
if (enable)
m_channelsMap.insert(chType, sv);
else
m_channelsMap.remove(chType, sv);
}
emit selectedFixturesChanged();
}
示例3: foreach
QList<Action *> Menu::findActions(const QMultiHash<int, QVariant> AData, bool ASearchInSubMenu /*= false*/) const
{
QList<Action *> actionList;
QList<int> keys = AData.keys();
foreach(Action *action,FActions)
{
foreach (int key, keys)
{
if (AData.values(key).contains(action->data(key)))
{
actionList.append(action);
break;
}
}
if (ASearchInSubMenu && action->menu())
actionList += action->menu()->findActions(AData,ASearchInSubMenu);
}
示例4: disconnectObject
void QxtRPCServiceIntrospector::disconnectObject(QObject* obj)
{
const QMetaObject* meta = obj->metaObject();
foreach(const SignalDef& sig, signalToId.keys()) {
// Iterate through all tracked connections and skip any that don't match the incoming object.
if(sig.first != obj) continue;
int methodID = methodIDs[qMakePair(meta, sig.second)];
foreach(int id, signalToId.values(sig)) {
// Iterate through all of the different connections for the object and explicitly disconnect them.
QMetaObject::disconnect(obj, methodID, this, id);
// Remove the connection from our mappings.
idToRpc.remove(id);
idToParams.remove(id);
}
// Remove the object/signal from the mapping.
signalToId.remove(sig);
}
}
示例5: ParseDirectoryFinished
void IcecastService::ParseDirectoryFinished(
QFuture<IcecastBackend::StationList> future) {
IcecastBackend::StationList all_stations = future.result();
sort(all_stations.begin(), all_stations.end(),
StationSorter<IcecastBackend::Station>());
// Remove duplicates by name. These tend to be multiple URLs for the same
// station.
IcecastBackend::StationList::iterator it =
unique(all_stations.begin(), all_stations.end(),
StationEquality<IcecastBackend::Station>());
all_stations.erase(it, all_stations.end());
// Cluster stations by genre.
QMultiHash<QString, IcecastBackend::Station*> genres;
// Add stations.
for (int i = 0; i < all_stations.count(); ++i) {
IcecastBackend::Station& s = all_stations[i];
genres.insert(s.genre, &s);
}
QSet<QString> genre_set = genres.keys().toSet();
// Merge genres with only 1 or 2 stations into "Other".
for (const QString& genre : genre_set) {
if (genres.count(genre) < 3) {
const QList<IcecastBackend::Station*>& small_genre = genres.values(genre);
for (IcecastBackend::Station* s : small_genre) {
s->genre = "Other";
}
}
}
backend_->ClearAndAddStations(all_stations);
app_->task_manager()->SetTaskFinished(load_directory_task_id_);
load_directory_task_id_ = 0;
}