本文整理汇总了C++中QVariantMap函数的典型用法代码示例。如果您正苦于以下问题:C++ QVariantMap函数的具体用法?C++ QVariantMap怎么用?C++ QVariantMap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QVariantMap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setProfileForKit
void QbsManager::addProfileFromKit(const ProjectExplorer::Kit *k)
{
const QString name = ProjectExplorer::Project::makeUnique(
QString::fromLatin1("qtc_") + k->fileSystemFriendlyName(), m_settings->profiles());
setProfileForKit(name, k);
addQtProfileFromKit(name, k);
// set up properties:
QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
QList<PropertyProvider *> providerList = ExtensionSystem::PluginManager::getObjects<PropertyProvider>();
foreach (PropertyProvider *provider, providerList) {
if (provider->canHandle(k))
data = provider->properties(k, data);
}
addProfile(name, data);
}
示例2: QVariantMap
void QSyncable::set(QVariantMap &data, const QStringList &path, const QVariant &value)
{
QString key = path[0];
if (path.size() == 1) {
data[key] = value;
} else {
if (!data.contains(key) || !data[key].canConvert<QVariantMap>()) {
data[key] = QVariantMap();
}
QStringList nextPath = path;
nextPath.removeFirst();
QVariantMap map = data[key].toMap();
set(map, nextPath, value);
data[key] = map;
}
}
示例3: qDebug
QVariantMap
QmlChoiseModel::get(int row) {
qDebug() << Q_FUNC_INFO << "get" << row;
if (row < 0 || row > _choiseItems.size() - 1) {
qWarning() << Q_FUNC_INFO << "Invalid row " << row << "max" << _choiseItems.size();
return QVariantMap();
}
QVariantMap map;
const ChoiseItem &item = _choiseItems.at(row);
map[_roleToProperty[IdRole]] = item.itemId;
map[_roleToProperty[ShortDescriptionChoiseRole]] = item.shortDescription;
map[_roleToProperty[LongDescriptionChoiseRole]] = item.longDescription;
return map;
}
示例4: QVariantMap
QVariantMap ThemeConfig::save()
{
QModelIndex index = configUi->themesListView->currentIndex();
if (!index.isValid()) {
return QVariantMap();
}
QVariantMap args;
args["sddm.conf/Theme/Current"] = index.data(ThemesModel::IdRole);
if (!mThemeConfigPath.isEmpty()) {
args["theme.conf.user/General/background"] = mBackgroundPath;
}
return args;
}
示例5: QVariantMap
TranslationInterface::~TranslationInterface()
{
#ifdef WITH_ANALYTICS
if (m_privacyLevel == NoPrivacy) {
m_analytics->trackEvent("Session End", QVariantMap(), true);
}
#endif
delete m_service;
delete m_services;
delete m_sourceLanguages;
delete m_targetLanguages;
delete m_sourceLanguage;
delete m_targetLanguage;
delete m_dict;
delete m_settings;
}
示例6: qfError
QVariantMap CardChecker::courseCodesForRunId(int run_id)
{
QVariantMap ret;
if(run_id <= 0) {
qfError() << "Run ID == 0";
return ret;
}
qf::qmlwidgets::framework::MainWindow *fwk = qf::qmlwidgets::framework::MainWindow::frameWork();
auto runs_plugin = qobject_cast<Runs::RunsPlugin *>(fwk->plugin("Runs"));
QF_ASSERT(runs_plugin != nullptr, "Bad plugin", return QVariantMap());
int course_id = runs_plugin->courseForRun(run_id);
if(course_id <= 0) {
qfError() << "Course ID == 0";
return ret;
}
{
qfs::QueryBuilder qb;
qb.select2("courses", "*")
.from("courses")
.where("courses.id=" QF_IARG(course_id));
qfs::Query q;
q.exec(qb.toString(), qf::core::Exception::Throw);
if(q.next())
ret = q.values();
}
{
qfs::QueryBuilder qb;
qb.select2("coursecodes", "position")
.select2("codes", "code, altCode, outOfOrder")
.from("coursecodes")
.join("coursecodes.codeId", "codes.id")
.where("coursecodes.courseId=" QF_IARG(course_id))
.orderBy("coursecodes.position");
qfs::Query q;
//qfWarning() << qb.toString();
q.exec(qb.toString(), qf::core::Exception::Throw);
QVariantList codes;
while (q.next()) {
codes << q.values();
}
ret["codes"] = codes;
}
return ret;
}
示例7: dialog
void DownloadRequestDialog::showPluginSettingsDialog(const QString &title, const QVariantList &settings) {
PluginSettingsDialog dialog(settings, this);
dialog.setWindowTitle(title);
dialog.setTimeout(DownloadRequestModel::instance()->requestedSettingsTimeout());
connect(DownloadRequestModel::instance(), SIGNAL(statusChanged(DownloadRequestModel::Status)),
&dialog, SLOT(close()));
switch (dialog.exec()) {
case QDialog::Accepted:
DownloadRequestModel::instance()->submitSettingsResponse(dialog.settings());
break;
case QDialog::Rejected:
DownloadRequestModel::instance()->submitSettingsResponse(QVariantMap());
break;
default:
break;
}
}
示例8: settings
void QbsManager::addProfileFromKit(const ProjectExplorer::Kit *k)
{
const QString name = QString::fromLatin1("qtc_%1_%2").arg(k->fileSystemFriendlyName().left(8),
QString::number(k->id().uniqueIdentifier(), 16));
qbs::Profile(name, settings()).removeProfile();
setProfileForKit(name, k);
addQtProfileFromKit(name, k);
// set up properties:
QVariantMap data = m_defaultPropertyProvider->properties(k, QVariantMap());
QList<PropertyProvider *> providerList = ExtensionSystem::PluginManager::getObjects<PropertyProvider>();
foreach (PropertyProvider *provider, providerList) {
if (provider->canHandle(k))
data = provider->properties(k, data);
}
addProfile(name, data);
}
示例9: createSession
void SessionAgent::createSession()
{
if (m_manager->isAvailable()) {
QDBusObjectPath obpath = m_manager->createSession(QVariantMap(),agentPath);
if (!obpath.path().isEmpty()) {
m_session = new Session(obpath.path(), this);
new SessionNotificationAdaptor(this);
QDBusConnection::systemBus().unregisterObject(agentPath);
if (!QDBusConnection::systemBus().registerObject(agentPath, this)) {
qDebug() << "Could not register agent object";
}
} else {
qDebug() << "agentPath is not valid" << agentPath;
}
} else {
qDebug() << Q_FUNC_INFO << "manager not valid";
}
}
示例10: qsrand
void GenerateDNASequenceTask::run( ) {
if ( seed < 0 ) {
qsrand( QDateTime::currentDateTime( ).toTime_t( ) );
} else {
qsrand( seed );
}
dbiRef = AppContext::getDbiRegistry( )->getSessionTmpDbiRef( stateInfo );
CHECK_OP( stateInfo, );
DbiConnection con( dbiRef, stateInfo );
CHECK_OP( stateInfo, );
results.reserve( count );
for ( int seqCount = 0; seqCount < count; seqCount++ ) {
U2SequenceImporter seqImporter( QVariantMap( ), true );
QByteArray sequenceChunk;
if( window > length ) {
window = length;
}
seqImporter.startSequence(stateInfo, dbiRef, U2ObjectDbi::ROOT_FOLDER, QString( "default" ), false);
CHECK_OP_BREAK( stateInfo );
for( int chunkCount = 0; chunkCount < length / window && !isCanceled( );
chunkCount++ )
{
DNASequenceGenerator::generateSequence( baseContent, window, sequenceChunk );
seqImporter.addBlock( sequenceChunk.constData( ), sequenceChunk.length( ), stateInfo );
CHECK_OP_BREAK( stateInfo );
const int currentProgress = int( 100 * ( seqCount + chunkCount * double ( window )
/ double ( length ) ) / double( count ) );
stateInfo.setProgress( currentProgress );
}
// append last chunk
DNASequenceGenerator::generateSequence( baseContent, length % window, sequenceChunk );
seqImporter.addBlock( sequenceChunk.constData( ), sequenceChunk.length( ), stateInfo );
CHECK_OP_BREAK( stateInfo );
U2Sequence seq = seqImporter.finalizeSequence( stateInfo );
CHECK_OP_BREAK( stateInfo );
results.append( seq );
stateInfo.setProgress( seqCount / count * 100 );
}
}
示例11: while
QColor Theme::color(const QString& name)
{
if(d->colorCache.contains(name))
return d->colorCache.value(name);
QStringList parts = name.split('/');
QColor result;
if(!parts.isEmpty())
{
QVariantMap map = d->colors;
QString current = parts.takeFirst();
while(map.contains(current))
{
QVariant value = map.value(current);
if(value.type() == QVariant::Map)
{
if(parts.isEmpty())
break;
map = value.toMap();
current = parts.takeFirst();
}
else
{
result = value.value<QColor>();
map = QVariantMap();
}
}
}
if(!result.isValid() && d->inheritedTheme) {
result = d->inheritedTheme->color(name);
}
if(!result.isValid()) {
qWarning() << "Unable to find color" << name;
} else {
d->colorCache.insert(name, result);
}
return result;
}
示例12: warning
QVariantMap FileTransferChannelCreationProperties::createRequest() const
{
if (!isValid()) {
warning() << "Invalid file transfer creation properties";
return QVariantMap();
}
QVariantMap request;
request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".ChannelType"),
TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER);
request.insert(TP_QT_IFACE_CHANNEL + QLatin1String(".TargetHandleType"),
(uint) Tp::HandleTypeContact);
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Filename"),
suggestedFileName());
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentType"),
contentType());
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Size"),
size());
if (hasContentHash()) {
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHashType"),
(uint) contentHashType());
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".ContentHash"),
contentHash());
}
if (hasDescription()) {
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Description"),
description());
}
if (hasLastModificationTime()) {
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".Date"),
(qulonglong) lastModificationTime().toTime_t());
}
if (hasUri()) {
request.insert(TP_QT_IFACE_CHANNEL_TYPE_FILE_TRANSFER + QLatin1String(".URI"),
uri());
}
return request;
}
示例13: authActionModifyUser
QVariantMap authActionModifyUser(int i, QIODevice *connection,
const QSqlDatabase& db, const QSqlDatabase& user_db,
const QVariantMap& action, const QString& email)
{
Q_UNUSED(i);
Q_UNUSED(db);
Q_UNUSED(user_db);
Q_UNUSED(connection);
QString target_email = action.value("email").toString();
QString new_email = action.value("new_email").toString();
QString name = action.value("name").toString();
QString pass = action.value("pass").toString();
QVariantMap perms = action.value("perms").toMap();
auth->modifyUser(email, target_email, new_email, name, pass, perms);
return QVariantMap();
}
示例14: tr
bool QgsProcessingProvider::addAlgorithm( QgsProcessingAlgorithm *algorithm )
{
if ( !algorithm )
return false;
if ( mAlgorithms.contains( algorithm->name() ) )
{
QgsMessageLog::logMessage( tr( "Duplicate algorithm name %1 for provider %2" ).arg( algorithm->name(), id() ), QObject::tr( "Processing" ) );
return false;
}
// init the algorithm - this allows direct querying of the algorithm's parameters
// and outputs from the provider's copy
algorithm->initAlgorithm( QVariantMap() );
algorithm->setProvider( this );
mAlgorithms.insert( algorithm->name(), algorithm );
return true;
}
示例15: QgsSettings
template<> QgsGeometryCheck *QgsGeometryCheckFactoryT<QgsGeometryTypeCheck>::createInstance( QgsGeometryCheckContext *context, const Ui::QgsGeometryCheckerSetupTab &ui ) const
{
QgsSettings().setValue( sSettingsGroup + "checkTypePoint", ui.checkBoxPoint->isChecked() );
QgsSettings().setValue( sSettingsGroup + "checkTypeMultipoint", ui.checkBoxMultipoint->isChecked() );
QgsSettings().setValue( sSettingsGroup + "checkTypeLine", ui.checkBoxLine->isChecked() );
QgsSettings().setValue( sSettingsGroup + "checkTypeMultiline", ui.checkBoxMultiline->isChecked() );
QgsSettings().setValue( sSettingsGroup + "checkTypePolygon", ui.checkBoxPolygon->isChecked() );
QgsSettings().setValue( sSettingsGroup + "checkTypeMultipolygon", ui.checkBoxMultipolygon->isChecked() );
int allowedTypes = 0;
if ( ui.checkBoxPoint->isEnabled() && ui.checkBoxPoint->isChecked() )
{
allowedTypes |= 1 << QgsWkbTypes::Point;
}
if ( ui.checkBoxMultipoint->isEnabled() && ui.checkBoxMultipoint->isChecked() )
{
allowedTypes |= 1 << QgsWkbTypes::MultiPoint;
}
if ( ui.checkBoxLine->isEnabled() && ui.checkBoxLine->isChecked() )
{
allowedTypes |= 1 << QgsWkbTypes::LineString;
}
if ( ui.checkBoxMultiline->isEnabled() && ui.checkBoxMultiline->isChecked() )
{
allowedTypes |= 1 << QgsWkbTypes::MultiLineString;
}
if ( ui.checkBoxPolygon->isEnabled() && ui.checkBoxPolygon->isChecked() )
{
allowedTypes |= 1 << QgsWkbTypes::Polygon;
}
if ( ui.checkBoxMultipolygon->isEnabled() && ui.checkBoxMultipolygon->isChecked() )
{
allowedTypes |= 1 << QgsWkbTypes::MultiPolygon;
}
if ( allowedTypes != 0 )
{
return new QgsGeometryTypeCheck( context, QVariantMap(), allowedTypes );
}
else
{
return nullptr;
}
}