void RenderableModelEntityItem::remapTextures() { if (!_model) { return; // nothing to do if we don't have a model } if (!_model->isLoadedWithTextures()) { return; // nothing to do if the model has not yet loaded it's default textures } if (!_originalTexturesRead && _model->isLoadedWithTextures()) { const QSharedPointer<NetworkGeometry>& networkGeometry = _model->getGeometry(); if (networkGeometry) { _originalTextures = networkGeometry->getTextureNames(); _originalTexturesRead = true; } } if (_currentTextures == _textures) { return; // nothing to do if our recently mapped textures match our desired textures } // since we're changing here, we need to run through our current texture map // and any textures in the recently mapped texture, that is not in our desired // textures, we need to "unset" QJsonDocument currentTexturesAsJson = QJsonDocument::fromJson(_currentTextures.toUtf8()); QJsonObject currentTexturesAsJsonObject = currentTexturesAsJson.object(); QVariantMap currentTextureMap = currentTexturesAsJsonObject.toVariantMap(); QJsonDocument texturesAsJson = QJsonDocument::fromJson(_textures.toUtf8()); QJsonObject texturesAsJsonObject = texturesAsJson.object(); QVariantMap textureMap = texturesAsJsonObject.toVariantMap(); foreach(const QString& key, currentTextureMap.keys()) { // if the desired texture map (what we're setting the textures to) doesn't // contain this texture, then remove it by setting the URL to null if (!textureMap.contains(key)) { QUrl noURL; qDebug() << "Removing texture named" << key << "by replacing it with no URL"; _model->setTextureWithNameToURL(key, noURL); } } // here's where we remap any textures if needed... foreach(const QString& key, textureMap.keys()) { QUrl newTextureURL = textureMap[key].toUrl(); qDebug() << "Updating texture named" << key << "to texture at URL" << newTextureURL; _model->setTextureWithNameToURL(key, newTextureURL); } _currentTextures = _textures; }
bool Config::getPluginIsPermitted(QString pluginName, QString feature){ QVariantMap permissions = this->getPluginPermissions(pluginName); if (permissions.keys().contains(feature)) return permissions[feature].toBool(); else return false; }
DeclarativeWindow::DeclarativeWindow (const QUrl& url, QVariantMap params, const QPoint& orig, ViewManager *viewMgr, ICoreProxy_ptr proxy, QWidget *parent) : QDeclarativeView (parent) { new Util::AutoResizeMixin (orig, [viewMgr] () { return viewMgr->GetFreeCoords (); }, this); if (!params.take ("keepOnFocusLeave").toBool ()) new Util::UnhoverDeleteMixin (this, SLOT (beforeDelete ())); setStyleSheet ("background: transparent"); setWindowFlags (Qt::Tool | Qt::FramelessWindowHint); setAttribute (Qt::WA_TranslucentBackground); for (const auto& cand : Util::GetPathCandidates (Util::SysPath::QML, "")) engine ()->addImportPath (cand); rootContext ()->setContextProperty ("colorProxy", new Util::ColorThemeProxy (proxy->GetColorThemeManager (), this)); for (const auto& key : params.keys ()) rootContext ()->setContextProperty (key, params [key]); engine ()->addImageProvider ("ThemeIcons", new Util::ThemeImageProvider (proxy)); setSource (url); connect (rootObject (), SIGNAL (closeRequested ()), this, SLOT (deleteLater ())); }
void ColorThemes::updateColorThemeMenu() { m_menu->clear(); const QSettings *s = Core::ICore::settings(); const QString currentTheme = s->value(Constants::C_SETTINGS_COLORSETTINGS_CURRENTCOLORTHEME, Constants::C_COLOR_SCHEME_DEFAULT).toString(); const QVariantMap data = s->value(Constants::C_SETTINGS_COLORSETTINGS_COLORTHEMES).toMap(); QStringList keys = data.keys(); keys.append(Constants::C_COLOR_SCHEME_SCXMLDOCUMENT); keys.append(Constants::C_COLOR_SCHEME_DEFAULT); for (const QString &key: keys) { const QString actionText = key == Constants::C_COLOR_SCHEME_DEFAULT ? tr("Factory Default") : key == Constants::C_COLOR_SCHEME_SCXMLDOCUMENT ? tr("Colors from SCXML-document") : key; QAction *action = m_menu->addAction(actionText, this, [this, key]() { selectColorTheme(key); }); action->setData(key); action->setCheckable(true); } m_menu->addSeparator(); m_menu->addAction(m_modifyAction); m_toolButton->setMenu(m_menu); selectColorTheme(currentTheme); }
QList<Profile> FindChromeProfile::find() { QString configDirectory = QStringLiteral("%1/.config/%2") .arg(m_homeDirectory, m_applicationName); QString localStateFileName = QStringLiteral("%1/Local State") .arg(configDirectory); QList<Profile> profiles; QFile localStateFile(localStateFileName); if (!localStateFile.open(QIODevice::ReadOnly | QIODevice::Text)) { return profiles; } QJsonDocument jdoc = QJsonDocument::fromJson(localStateFile.readAll()); if(jdoc.isNull()) { qDebug() << "error opening " << QFileInfo(localStateFile).absoluteFilePath(); return profiles; } QVariantMap localState = jdoc.object().toVariantMap(); QVariantMap profilesConfig = localState.value(QStringLiteral("profile")).toMap().value(QStringLiteral("info_cache")).toMap(); foreach(const QString &profile, profilesConfig.keys()) { const QString profilePath = QStringLiteral("%1/%2").arg(configDirectory, profile); const QString profileBookmarksPath = QStringLiteral("%1/%2").arg(profilePath, QStringLiteral("Bookmarks")); profiles << Profile(profileBookmarksPath, FaviconFromBlob::chrome(profilePath, this)); } return profiles; }
bool ArbitraryRequestHandler::request(int requestType, const QString &requestUri, const QVariantMap &queryItems, const QString &postData) { if (reply) { qWarning() << Q_FUNC_INFO << "Warning: cannot start arbitrary request: another arbitrary request is in progress"; return false; } QList<QPair<QString, QString> > qil; QStringList queryItemKeys = queryItems.keys(); foreach (const QString &qik, queryItemKeys) qil.append(qMakePair<QString, QString>(qik, queryItems.value(qik).toString())); QUrl url(requestUri); url.setQueryItems(qil); QNetworkReply *sniReply = 0; switch (requestType) { case SocialNetworkInterface::Get: sniReply = q->d->qnam->get(QNetworkRequest(url)); break; case SocialNetworkInterface::Post: sniReply = q->d->qnam->post(QNetworkRequest(url), QByteArray::fromBase64(postData.toLatin1())); break; default: sniReply = q->d->qnam->deleteResource(QNetworkRequest(url)); break; } if (sniReply) { reply = sniReply; connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(errorHandler(QNetworkReply::NetworkError))); connect(reply, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrorsHandler(QList<QSslError>))); connect(reply, SIGNAL(finished()), this, SLOT(finishedHandler())); return true; } qWarning() << Q_FUNC_INFO << "Warning: cannot start arbitrary request: null reply"; return false; }
void CreateAccount::pluginFinished(const QString &screenName, const QString &secret, const QVariantMap &data) { // Set up the new identity SignOn::IdentityInfo info; info.setStoreSecret(true); info.setUserName(screenName); info.setSecret(secret, true); info.setCaption(m_providerName); info.setAccessControlList(QStringList(QLatin1String("*"))); info.setType(SignOn::IdentityInfo::Application); Q_FOREACH (const QString &key, data.keys()) { // If a key with __service/ prefix exists and its value is false, // add it to m_disabledServices which will later be used for disabling // the services contained in that list if (key.startsWith(QLatin1String("__service/")) && !data.value(key).toBool()) { m_disabledServices << key.mid(10); } m_account->setValue(key, data.value(key).toString()); } m_identity = SignOn::Identity::newIdentity(info, this); connect(m_identity, SIGNAL(info(SignOn::IdentityInfo)), SLOT(info(SignOn::IdentityInfo))); m_done = true; connect(m_identity, &SignOn::Identity::credentialsStored, m_identity, &SignOn::Identity::queryInfo); m_identity->storeCredentials(); }
void BookmarksDialog::loadBookmarks() { QVariantMap map; QFile jsonFile(bookmarksJsonPath); if (!jsonFile.open(QIODevice::ReadOnly)) qWarning() << "[Bookmarks] cannot open" << QDir::toNativeSeparators(bookmarksJsonPath); else { try { map = StelJsonParser::parse(jsonFile.readAll()).toMap(); jsonFile.close(); bookmarksCollection.clear(); QVariantMap bookmarksMap = map.value("bookmarks").toMap(); int i = 0; for (auto bookmarkKey : bookmarksMap.keys()) { QVariantMap bookmarkData = bookmarksMap.value(bookmarkKey).toMap(); bookmark bm; QString JDs = ""; bm.name = bookmarkData.value("name").toString(); QString nameI18n = bookmarkData.value("nameI18n").toString(); if (!nameI18n.isEmpty()) bm.nameI18n = nameI18n; QString JD = bookmarkData.value("jd").toString(); if (!JD.isEmpty()) { bm.jd = JD; JDs = StelUtils::julianDayToISO8601String(JD.toDouble() + core->getUTCOffset(JD.toDouble())/24.).replace("T", " "); } QString Location = bookmarkData.value("location").toString(); if (!Location.isEmpty()) bm.location = Location; QString RA = bookmarkData.value("ra").toString(); if (!RA.isEmpty()) bm.ra = RA; QString Dec = bookmarkData.value("dec").toString(); if (!Dec.isEmpty()) bm.dec = Dec; bm.isVisibleMarker = bookmarkData.value("isVisibleMarker", false).toBool(); double fov = bookmarkData.value("fov").toDouble(); if (fov > 0.0) bm.fov = fov; bookmarksCollection.insert(bookmarkKey, bm); addModelRow(i, bookmarkKey, bm.name, bm.nameI18n, JDs, Location); i++; } } catch (std::runtime_error &e) { qDebug() << "[Bookmarks] File format is wrong! Error: " << e.what(); return; } } }
QString CModListView::genChangelogText(CModEntry &mod) { QString headerTemplate = "<p><span style=\" font-weight:600;\">%1: </span></p>"; QString entryBegin = "<p align=\"justify\"><ul>"; QString entryEnd = "</ul></p>"; QString entryLine = "<li>%1</li>"; //QString versionSeparator = "<hr/>"; QString result; QVariantMap changelog = mod.getValue("changelog").toMap(); QList<QString> versions = changelog.keys(); std::sort(versions.begin(), versions.end(), [](QString lesser, QString greater) { return !CModEntry::compareVersions(lesser, greater); }); for (auto & version : versions) { result += headerTemplate.arg(version); result += entryBegin; for (auto & line : changelog.value(version).toStringList()) result += entryLine.arg(line); result += entryEnd; } return result; }
void WebDispatch::init() { QFile f( "sources.json" ); if( ! f.exists() ) { __process_websources(); return; } QVariantMap qmap; if( ! Assist::Json::json_read( f, qmap ) ) { __process_websources(); return; } ELSE_DEBUG_P( "Sources is preconfigured." ); // Конвертируем QVariantMap в QMap<QString, QStringList> QStringList keys = qmap.keys(); foreach( QString key, keys ) { this->qmap.insert( key, qmap.value( key ).toStringList() ); }
/** * @brief FilePersistence::modifyAccountObject * @param modifications * @return */ bool FilePersistence::modifyAccountObject(const OptionTable &modifications) { int index = findAccountObj(modifications); if (index < 0) { m_error.append(QString("Could not modify Account object !\n")); m_error.append(QString("There is no such an Account object.\n")); return false; } QVariantMap modifyValues = variantMapFromOptionTable(modifications); if (modifications.contains('i')) { modifyValues.remove(optionToRealName('i')); } else { modifyValues.remove(optionToRealName('p')); modifyValues.remove(optionToRealName('u')); } QVariantMap originObject = m_fileContent[index]; QStringList keyList = modifyValues.keys(); for (int index=0; index<keyList.size(); ++index) { QVariant value = modifyValues.value(keyList[index]); originObject.insert(keyList[index], value); } m_isModified = true; return true; }
void VariantTable::insert(QVariantMap value) { QStringList col_names; QStringList col_marks; QVariantList col_values; QString keyVal; foreach (const QString &key, value.keys()) { if (!blueprint.contains(key)) { qCritical("Localstorage: variant table %s. Tried to insert an object that does not match the blueprint.", qPrintable(name)); return; } col_names.append(key); //TODO type check keyVal = blueprint.value(key).toString(); if( keyVal == "binary" || keyVal.contains("BLOB", Qt::CaseInsensitive) ) { QVariant data (writeSerialized(value.value(key))); col_values.append(data); } else col_values.append(value.value(key)); col_marks.append("?"); } QString cmd("INSERT OR REPLACE INTO %1 (%2) VALUES (%3)"); cmd = cmd.arg(name) .arg(col_names.join(", ")) .arg(col_marks.join(", ")); QSqlQuery query(db); query.prepare(cmd); foreach (QVariant col_value, col_values) { query.addBindValue(col_value); }
void RemoteActivatable::propertiesChanged(const QVariantMap &changedProperties) { Q_D(RemoteActivatable); QStringList propKeys = changedProperties.keys(); QLatin1String deviceUniKey("deviceUni"), activatableTypeKey("activatableType"), sharedKey("shared"); QVariantMap::const_iterator it = changedProperties.find(deviceUniKey); if (it != changedProperties.end()) { d->deviceUni = it->toString(); propKeys.removeOne(deviceUniKey); } it = changedProperties.find(activatableTypeKey); if (it != changedProperties.end()) { d->activatableType = (Knm::Activatable::ActivatableType)it->toUInt(); propKeys.removeOne(activatableTypeKey); } it = changedProperties.find(sharedKey); if (it != changedProperties.end()) { d->shared = it->toBool(); propKeys.removeOne(sharedKey); } /*if (propKeys.count()) { qDebug() << "Unhandled properties: " << propKeys; }*/ }
ItemData::ItemData(const QModelIndex &index, int maxBytes, QWidget *parent) : QLabel(parent) , ItemWidget(this) { setTextInteractionFlags(Qt::TextSelectableByMouse); setContentsMargins(4, 4, 4, 4); setTextFormat(Qt::RichText); QString text; const QVariantMap data = index.data(contentType::data).toMap(); foreach ( const QString &format, data.keys() ) { QByteArray bytes = data[format].toByteArray(); const int size = bytes.size(); bool trimmed = size > maxBytes; if (trimmed) bytes = bytes.left(maxBytes); bool hasText = format.startsWith("text/") || format.startsWith("application/x-copyq-owner-window-title"); const QString content = hasText ? escapeHtml(stringFromBytes(bytes, format)) : hexData(bytes); text.append( QString("<p>") ); text.append( QString("<b>%1</b> (%2 bytes)<pre>%3</pre>") .arg(format) .arg(size) .arg(content) ); text.append( QString("</p>") ); if (trimmed) text.append( QString("<p>...</p>") ); } setText(text); }
void AuthPlugin::onDataUpdated(const QVariantMap &map) { QString command = map["command"].toString(); if (command == "login") { QString key = map["token"].toString(); if (key.isEmpty() || key.isNull()) { //request login UI if (mWidget) { Q_EMIT spawnView(mWidget); mWidget->setVisible(true); mWidget->createAuthDialog(); } } } if (command == "friends") { qDebug() << map.keys(); mContactUI->setFacebookContactData(map["data"].toHash()); } if (command == "userinfo") { mContactUI->addContact(map); } }
void ModemManager::ModemLocationInterface::propertiesChanged(const QString & interface, const QVariantMap & properties) { mmDebug() << interface << properties.keys(); if (interface == QString("org.freedesktop.ModemManager.Modem.Location")) { QLatin1String capabilities("Capabilities"); QLatin1String enabled("Enabled"); QLatin1String signalsLocation("SignalsLocation"); QLatin1String location("Location"); QVariantMap::const_iterator it = properties.find(capabilities); if ( it != properties.end()) { emit capabilitiesChanged((ModemManager::ModemLocationInterface::Capability)it->toUInt()); } it = properties.find(enabled); if ( it != properties.end()) { emit enabledChanged(it->toBool()); } it = properties.find(signalsLocation); if ( it != properties.end()) { emit signalsLocationChanged(it->toBool()); } it = properties.find(location); if ( it != properties.end()) { QVariant v = it.value(); LocationInformationMap map; if (v.canConvert<LocationInformationMap>()) { map = v.value<LocationInformationMap>(); } else { mmDebug() << "Error converting LocationInformationMap property"; } emit locationChanged(map); } } }
void ApplicationUI::checkForChangelog() { qDebug() << "ApplicationUI::checkForChangelog()"; bb::data::JsonDataAccess jda; QString path = "app/native/assets/Changelog/changelog.json"; QVariantMap changelog = jda.load(path).toMap(); QString newChangelogForThisUser; QStringList allKeys = changelog.keys(); qDebug() << "allKeys:" << allKeys; for(int i = (allKeys.size() - 1); i >= 0; i--) { QStringList thisKey = allKeys[i].split("."); QStringList lastVersionLoadedInSettings = m_settings->value("lastVersionLoaded", "0.0.0.0").toString().split("."); qDebug() << thisKey << lastVersionLoadedInSettings; bool showThisChangelog = false; if (thisKey.size() == lastVersionLoadedInSettings.size()) { for (int j = 0; j < thisKey.size(); j++) { if (thisKey[j] > lastVersionLoadedInSettings[j]) { showThisChangelog = true; j = thisKey.size(); } else { if (thisKey[j] < lastVersionLoadedInSettings[j]) { j = thisKey.size(); } } } } if (showThisChangelog) { newChangelogForThisUser.append(allKeys[i] + "\n" + changelog.value(allKeys[i]).toString() + "\n\n"); qDebug() << "appending:" << QString(allKeys[i] + "\n" + changelog.value(allKeys[i]).toString() + "\n\n"); } } qDebug() << "newChangelogForThisUser:" << newChangelogForThisUser; if (!newChangelogForThisUser.isEmpty()) emit newChangelog(newChangelogForThisUser); }
QByteArray Tomahawk::ExternalResolverGui::fixDataImagePaths( const QByteArray& data, bool compressed, const QVariantMap& images ) { // with a list of images and image data, write each to a temp file, replace the path in the .ui file with the temp file path QString uiFile = QString::fromUtf8( data ); foreach( const QString& filename, images.keys() ) { if( !uiFile.contains( filename ) ) // make sure the image is used continue; QString fullPath = QDir::tempPath() + "/" + filename; QFile imgF( fullPath ); if( !imgF.open( QIODevice::WriteOnly ) ) { qWarning() << "Failed to write to temporary image in UI file:" << filename << fullPath; continue; } QByteArray data = images[ filename ].toByteArray(); // qDebug() << "expanding data:" << data << compressed; data = compressed ? qUncompress( QByteArray::fromBase64( data ) ) : QByteArray::fromBase64( data ); imgF.write( data ); imgF.close(); // replace the path to the image with the real path uiFile.replace( filename, fullPath ); } return uiFile.toUtf8(); }
void TodoEditPage::todoChanged(QOrganizerManager *manager, const QOrganizerTodo &todo) { m_manager = manager; m_organizerTodo = todo; m_subjectEdit->setText(todo.displayLabel()); m_startTimeEdit->setDateTime(todo.startDateTime()); m_dueTimeEdit->setDateTime(todo.dueDateTime()); int index = m_priorityEdit->findData(QVariant(todo.priority())); m_priorityEdit->setCurrentIndex(index); index = m_priorityEdit->findData(QVariant(todo.status())); m_statusEdit->setCurrentIndex(index); // set calendar selection m_calendarComboBox->clear(); // resolve metadata field that contains calendar name (if any) QString calendarNameMetadataKey; m_collections = m_manager->collections(); if (!m_collections.isEmpty()) { QOrganizerCollection firstCollection = m_collections[0]; QVariantMap metadata = firstCollection.metaData(); QList<QString> metaDataKeys = metadata.keys(); foreach(QString key, metaDataKeys) { if (key.indexOf("name", 0, Qt::CaseInsensitive) != -1) { calendarNameMetadataKey = key; break; } } }
void ClipboardMonitor::onMessageReceived(const QByteArray &message, int messageCode) { if (messageCode == MonitorPing) { sendMessage( QByteArray(), MonitorPong ); #ifdef Q_OS_WIN // Qt BUG: This needs to be called regularly so that QClipboard emits changed() signal. QApplication::clipboard()->mimeData(); #endif } else if (messageCode == MonitorSettings) { QDataStream stream(message); QVariantMap settings; stream >> settings; if ( hasLogLevel(LogDebug) ) { COPYQ_LOG("Loading configuration:"); foreach (const QString &key, settings.keys()) { QVariant val = settings[key]; const QString str = val.canConvert<QStringList>() ? val.toStringList().join(",") : val.toString(); COPYQ_LOG( QString(" %1=%2").arg(key).arg(str) ); } } if ( settings.contains("formats") ) m_formats = settings["formats"].toStringList(); #ifdef COPYQ_WS_X11 m_x11->loadSettings(settings); #endif connect( QApplication::clipboard(), SIGNAL(changed(QClipboard::Mode)), this, SLOT(checkClipboard(QClipboard::Mode)), Qt::UniqueConnection ); COPYQ_LOG("Configured"); } else if (messageCode == MonitorChangeClipboard) {
void CaptureContext::LoadRenames(const QString &data) { QVariantMap root = JSONToVariant(data); if(root.contains(lit("CustomResourceNames"))) { QVariantMap resources = root[lit("CustomResourceNames")].toMap(); for(const QString &str : resources.keys()) { ResourceId id; if(str.startsWith(lit("resourceid::"))) { qulonglong num = str.mid(sizeof("resourceid::") - 1).toULongLong(); memcpy(&id, &num, sizeof(num)); } else { qCritical() << "Unrecognised resourceid encoding" << str; } if(id != ResourceId()) m_CustomNames[id] = resources[str].toString(); } } }
void PrefabSystem::updateComponentInPrefab(const QString& path, const QString& component, const QVariantMap& values, bool updateInstances) { EntitySystem* es = entityManager()->system(component); Q_ASSERT(es); auto i = _prefabs.find(path); if(i == _prefabs.end()) { return; } Prefab* prefab = i.value().data(); QVariantMap current = prefab->components()[component].toMap(); for(QString param : values.keys()) { current[param] = values[param]; } for(QString param : prefab->parameters()) { current.remove(param); } prefab->_components[component] = current; if(updateInstances) { for(auto k = this->begin(); k != this->end(); ++k) { if(es->component(k->first)) { es->fromVariantMap(k->first, values); } } } }
void RemoteComponent::handleResource(QHttpRequest* request, QHttpResponse* response) { if (request->method() == qhttp::EHTTP_GET) { QVariantMap headers = ResourceInformation(); QByteArray outputData; QXmlStreamWriter output(&outputData); output.setAutoFormatting(true); output.writeStartDocument(); output.writeStartElement("MediaContainer"); output.writeStartElement("Player"); for(const QString& key : headers.keys()) output.writeAttribute(key, headers[key].toString()); output.writeEndElement(); output.writeEndDocument(); response->setStatusCode(qhttp::ESTATUS_OK); response->write(outputData); response->end(); } else { response->setStatusCode(qhttp::ESTATUS_METHOD_NOT_ALLOWED); response->end(); } }
void Service::setIpv4Settings(const QVariantMap &map) { StringMap settings; Q_FOREACH (const QString &key, map.keys()) settings.insert(key, map.value(key).toString()); m_service->SetProperty("IPv4.Configuration", QDBusVariant(qVariantFromValue(settings))); }
void GameEventMultiplierMap::fromVariant(const QVariant &variant, GameEventMultiplierMap &multipliers) { QVariantMap variantMap = variant.toMap(); for (const QString &key : variantMap.keys()) { multipliers[GameEventType::fromString(key)] = variantMap[key].toDouble(); } }
void HTTPReply::sendHeaders(uint responseCode, const QString &mimeType, const QVariantMap &headers) { QStringList headerList; foreach (const QString &key, headers.keys()) headerList << QString("%1: %2").arg(key, headers.value(key).toString()); sendHeaders(responseCode, mimeType, headerList); }
QStringMap convertFromVariant(const QVariantMap &val) { QStringMap ret; for(const QString &k : val.keys()) { ret[k] = val[k].toString(); } return ret; }
void ActionDialog::setInputData(const QVariantMap &data) { m_data = data; QString defaultFormat = ui->comboBoxInputFormat->currentText(); initFormatComboBox(ui->comboBoxInputFormat, data.keys()); const int index = qMax(0, ui->comboBoxInputFormat->findText(defaultFormat)); ui->comboBoxInputFormat->setCurrentIndex(index); }
Q_INVOKABLE void writeProperties(QVariant propertyMap) { auto offscreenUi = DependencyManager::get<OffscreenUi>(); offscreenUi->executeOnUiThread([=] { QVariantMap map = propertyMap.toMap(); for (const QString& key : map.keys()) { _qmlObject->setProperty(key.toStdString().c_str(), map[key]); } }); }
QList<QString> Document::getAttachmentIds(){ QList<QString> results; if ( map.contains("_attachments") ){ QVariant var = map["_attachments"]; QVariantMap attachments = var.toMap(); return attachments.keys(); } return results; }