本文整理汇总了C++中QVariantMap::uniqueKeys方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantMap::uniqueKeys方法的具体用法?C++ QVariantMap::uniqueKeys怎么用?C++ QVariantMap::uniqueKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QVariantMap
的用法示例。
在下文中一共展示了QVariantMap::uniqueKeys方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseResponseListFolders
void DBTalker::parseResponseListFolders(const QByteArray& data)
{
//added root in list at constructor and call getfolderslist after calling list folders in dbwindow
QJson::Parser parser;
bool ok;
QVariant result = parser.parse(data,&ok);
if(!ok)
{
emit signalBusy(false);
emit signalListAlbumsFailed(i18n("Failed to list folders"));
return;
}
QList<QPair<QString, QString> > list;
list.clear();
list.append(qMakePair(QString("/"),QString("root")));
QVariantMap rmap = result.toMap();
QList<QString> a = rmap.uniqueKeys();
for(int i=0;i<rmap.size();i++)
{
if(a[i] == "contents")
{
QVariantList qwe = rmap[a[i]].toList();
foreach(QVariant abc, qwe)
{
QVariantMap qwer = abc.toMap();
QList<QString> b = qwer.uniqueKeys();
QString path("");
QString isDir("");
int temp = 0;
for(int i=0;i<qwer.size();i++)
{
if(b[i] == "is_dir")
isDir = qwer[b[i]].value<QString>();
if(b[i] == "path")
{
path = qwer[b[i]].value<QString>();
temp = i;
}
}
if(QString::compare(isDir, QString("true"), Qt::CaseInsensitive) == 0)
{
kDebug() << temp << " " << b[temp] << " : " << qwer[b[temp]] << " " << qwer[b[temp]].value<QString>() << endl;
QString name = qwer[b[temp]].value<QString>().section('/',-2);
kDebug() << "str " << name;
list.append(qMakePair(qwer[b[temp]].value<QString>(),name));
queue.enqueue(qwer[b[temp]].value<QString>());
}
}
}
示例2: parseResponseAddPhoto
void DBTalker::parseResponseAddPhoto(const QByteArray& data)
{
bool success = false;
QJson::Parser parser;
bool ok;
QVariant result = parser.parse(data, &ok);
QVariantMap rmap = result.toMap();
QList<QString> keys = rmap.uniqueKeys();
for(int i=0;i<rmap.size();i++)
{
if(keys[i] == "bytes")
{
success = true;
break;
}
}
emit signalBusy(false);
if(!success)
{
emit signalAddPhotoFailed(i18n("Failed to upload photo"));
}
else
{
emit signalAddPhotoSucceeded();
}
}
示例3: parseResponseUserName
void DBTalker::parseResponseUserName(const QByteArray& data)
{
QJson::Parser parser;
bool ok;
QVariant result = parser.parse(data,&ok);
QVariantMap rmap = result.toMap();
QList<QString> keys = rmap.uniqueKeys();
QString temp;
for(int i=0;i<rmap.size();i++)
{
if(keys[i] == "display_name")
{
temp = rmap[keys[i]].value<QString>();
}
}
emit signalBusy(false);
emit signalSetUserName(temp);
}
示例4: load
bool CoreService::load() {
sensitiveSettings()->beginGroup("session");
QString sessionId = sensitiveSettings()->value("id").toString();
QString accessToken = sensitiveSettings()->value("access_token").toString();
sensitiveSettings()->endGroup();
// Required here so that the setup dialog also gets this palette
getInterface()->setTheme();
getInterface()->start();
SetupDialog::LoginMethod method = SetupDialog::LoginSessionId;
if (!accessToken.isEmpty()) {
method = SetupDialog::LoginOAuth;
}
while (sessionId.isEmpty() && accessToken.isEmpty()) {
// Oh no, run setup.
int result = getInterface()->showSetup(); // Blocking
if (result != 0x0) {
getInterface()->window()->close();
return false;
}
QVariantMap map = getInterface()->getSetupDialog()->getData();
// Setup completed, we should have valid data
sensitiveSettings()->beginGroup("session");
for (QString key : map.uniqueKeys()) {
sensitiveSettings()->setValue(key, map.value(key));
}
sessionId = map.value("id").toString();
sensitiveSettings()->endGroup();
method = (SetupDialog::LoginMethod)map.value("method").toInt();
if (method == SetupDialog::LoginOAuth && !map.value("access_token").toString().isEmpty()) {
break;
}
}
// These are requirements for data we need before the application loads
_requiredData.clear();
// Load Plugins
getPluginManager()->scanPlugins(true);
getPluginManager()->verifyPlugins();
getPluginManager()->preparePlugins();
// Load the main application!
/* Require leagues list */ {
ADD_REQUIREMENT(session(), Session::Request::leaguesList, QStringList, leagues);
session()->fetchLeagues();
}
/* Require profile data */ {
ADD_REQUIREMENT(session(), Session::Request::profileData, QString, profile);
switch (method) {
case SetupDialog::LoginSessionId:
case SetupDialog::LoginEmail:
case SetupDialog::LoginSteam:
session()->loginWithSessionId(sessionId);
break;
case SetupDialog::LoginOAuth:
session()->fetchProfileData();
break;
}
// TODO(rory): Improve this
connect(session(), &Session::Request::loginResult,
[this] (int result, QString resultString) {
if (result == 0) {
}
else {
qDebug() << "Failed to log in: " << resultString;
}
});
}
return true;
}