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


C++ QVariantHash::insert方法代码示例

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


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

示例1: testNotificationNotShownIfNoSummaryOrBody

void Ut_NotificationPreviewPresenter::testNotificationNotShownIfNoSummaryOrBody()
{
    QFETCH(QString, previewSummary);
    QFETCH(QString, previewBody);
    QFETCH(int, changedSignalCount);
    QFETCH(int, presentedSignalCount);
    QFETCH(bool, windowVisible);

    NotificationPreviewPresenter presenter;
    QSignalSpy changedSpy(&presenter, SIGNAL(notificationChanged()));
    QSignalSpy presentedSpy(&presenter, SIGNAL(notificationPresented(uint)));

    // Create notification
    LipstickNotification *notification = new LipstickNotification;
    QVariantHash hints;
    hints.insert(NotificationManager::HINT_PREVIEW_SUMMARY, previewSummary);
    hints.insert(NotificationManager::HINT_PREVIEW_BODY, previewBody);
    notification->setHints(hints);
    notificationManagerNotification.insert(1, notification);
    presenter.updateNotification(1);

    // Check whether the expected notification is signaled onwards
    QCOMPARE(changedSpy.count(), changedSignalCount);
    QCOMPARE(presentedSpy.count(), presentedSignalCount);

    QCOMPARE(homeWindowVisible.isEmpty(), !windowVisible);
    if (windowVisible) {
        // Check whether the window was shown
        QCOMPARE(homeWindowVisible[homeWindows.first()], windowVisible);
    }
}
开发者ID:SamuelNevala,项目名称:lipstick,代码行数:31,代码来源:ut_notificationpreviewpresenter.cpp

示例2: Menu

Menu *FileEnginePrivate::createMenu(const QString &id, QObject *parent)
{
    settings->beginGroup(id);

    Menu *menu = new Menu(id);

    menu->setName(settings->value(QStringLiteral("Name")).toString());
    menu->setLocations(settings->value(QStringLiteral("Locations")).toStringList());
    menu->setAutoAddPages(settings->value(QStringLiteral("AutoAddPages")).toBool());

    QList<QVariantHash> urls;

    int size = settings->beginReadArray(QStringLiteral("urls"));
    for (int i = 0; i < size; ++i) {
        settings->setArrayIndex(i);
        QVariantHash data;
        // TODO read all data
        data.insert(QStringLiteral("id"), i);
        data.insert(QStringLiteral("text"), settings->value(QStringLiteral("text")));
        data.insert(QStringLiteral("url"), settings->value(QStringLiteral("url")));
        data.insert(QStringLiteral("attr"), settings->value(QStringLiteral("attr")));
        urls.append(data);
    }
    settings->endArray();

    menu->setEntries(urls);

    settings->endGroup(); // menu name

    return menu;
}
开发者ID:buschmann23,项目名称:CMlyst,代码行数:31,代码来源:fileengine.cpp

示例3: parseMapping

QVariantHash FSTReader::parseMapping(QIODevice* device) {
    QVariantHash properties;
    
    QByteArray line;
    while (!(line = device->readLine()).isEmpty()) {
        if ((line = line.trimmed()).startsWith('#')) {
            continue; // comment
        }
        QList<QByteArray> sections = line.split('=');
        if (sections.size() < 2) {
            continue;
        }
        QByteArray name = sections.at(0).trimmed();
        if (sections.size() == 2) {
            properties.insertMulti(name, sections.at(1).trimmed());
            
        } else if (sections.size() == 3) {
            QVariantHash heading = properties.value(name).toHash();
            heading.insertMulti(sections.at(1).trimmed(), sections.at(2).trimmed());
            properties.insert(name, heading);
            
        } else if (sections.size() >= 4) {
            QVariantHash heading = properties.value(name).toHash();
            QVariantList contents;
            for (int i = 2; i < sections.size(); i++) {
                contents.append(sections.at(i).trimmed());
            }
            heading.insertMulti(sections.at(1).trimmed(), contents);
            properties.insert(name, heading);
        }
    }
    
    return properties;
}
开发者ID:DaveDubUK,项目名称:hifi,代码行数:34,代码来源:FSTReader.cpp

示例4: getCurrentData

QVariantHash WeatherWidget::getCurrentData()
{
    QVariantHash data;
    data.insert("weatherCurrent", weatherDataWidget->getCurrentData());
    data.insert("weatherForecast", forecastDataWidget->getCurrentData());
    return data;
}
开发者ID:dgerlach,项目名称:Thermostat-Demo,代码行数:7,代码来源:weatherwidget.cpp

示例5: setMUCAffiliationAndRole

void JMUCUser::setMUCAffiliationAndRole(MUCRoom::Affiliation affiliation, MUCRoom::Role role)
{
	int oldPriority = priority();
	d_func()->affiliation = affiliation;
	d_func()->role = role;
	int newPriority = priority();
	emit priorityChanged(oldPriority, newPriority);
	
	QString iconName;
	if (affiliation == MUCRoom::AffiliationOwner)
		iconName = QStringLiteral("user-role-owner");
	else if (affiliation == MUCRoom::AffiliationAdmin)
		iconName = QStringLiteral("user-role-admin");
	else if (role == MUCRoom::RoleModerator)
		iconName = QStringLiteral("user-role-moderator");
	else if (role == MUCRoom::RoleVisitor)
		iconName = QStringLiteral("user-role-visitor");
	else if (affiliation == MUCRoom::AffiliationMember)
		iconName = QStringLiteral("user-role-member");
	else
		iconName = QStringLiteral("user-role-participant");
	
	QVariantHash clientInfo;
	ExtensionIcon extIcon(iconName);
	clientInfo.insert("id", "mucRole");
	clientInfo.insert("icon", QVariant::fromValue(extIcon));
	clientInfo.insert("priorityInContactList", 30);
	setExtendedInfo("mucRole", clientInfo);
}
开发者ID:VladRassokhin,项目名称:qutim,代码行数:29,代码来源:jmucuser.cpp

示例6: generate

QString TemplateLayout::generate()
{
	int progress = 0;
	int totalWork = getTotalWork(PrintOptions);
	QString templateName;

	QString htmlContent;
	m_engine = new Grantlee::Engine(this);

	QSharedPointer<Grantlee::FileSystemTemplateLoader> m_templateLoader =
		QSharedPointer<Grantlee::FileSystemTemplateLoader>(new Grantlee::FileSystemTemplateLoader());
	m_templateLoader->setTemplateDirs(QStringList() << getSubsurfaceDataPath("printing_templates"));
	m_engine->addTemplateLoader(m_templateLoader);

	Grantlee::registerMetaType<Dive>();
	Grantlee::registerMetaType<template_options>();
	Grantlee::registerMetaType<print_options>();

	QVariantHash mapping;
	QVariantList diveList;

	struct dive *dive;
	int i;
	for_each_dive (i, dive) {
		//TODO check for exporting selected dives only
		if (!dive->selected && PrintOptions->print_selected)
			continue;
		Dive d(dive);
		diveList.append(QVariant::fromValue(d));
		progress++;
		emit progressUpdated(progress * 100.0 / totalWork);
	}
	mapping.insert("dives", diveList);
	mapping.insert("template_options", QVariant::fromValue(*templateOptions));
	mapping.insert("print_options", QVariant::fromValue(*PrintOptions));

	Grantlee::Context c(mapping);

	if (PrintOptions->p_template == print_options::ONE_DIVE) {
		templateName = "one_dive.html";
	} else if (PrintOptions->p_template == print_options::TWO_DIVE) {
		templateName = "two_dives.html";
	} else if (PrintOptions->p_template == print_options::CUSTOM) {
		templateName = "custom.html";
	}
	Grantlee::Template t = m_engine->loadByName(templateName);
	if (!t || t->error()) {
		qDebug() << "Can't load template";
		return htmlContent;
	}

	htmlContent = t->render(&c);

	if (t->error()) {
		qDebug() << "Can't render template";
		return htmlContent;
	}
	return htmlContent;
}
开发者ID:Acidburn0zzz,项目名称:subsurface,代码行数:59,代码来源:templatelayout.cpp

示例7: testHelpers

void TestMustache::testHelpers()
{
	QVariantHash args;
	args.insert("name", "Jim Smith");
	args.insert("age", 42);

	QString output = Mustache::renderTemplate("Hello {{name}}, you are {{age}}", args);
	QCOMPARE(output, QString("Hello Jim Smith, you are 42"));
}
开发者ID:anjinkristou,项目名称:qt-mustache,代码行数:9,代码来源:test_mustache.cpp

示例8: foreach

 foreach (const QString& lib, Toolkit::librariesWithExamples())
 {
     QVariantHash libDescription;
     libDescription.insert("name", lib);
     QVariantList examples;
     foreach (const QString &example, Toolkit::findLibraryExamples(lib))
         examples.append(example);
     libDescription.insert("examples", examples);
     librariesWithExamples << libDescription;
 }
开发者ID:coolshou,项目名称:arduide,代码行数:10,代码来源:Browser.cpp

示例9: LipstickNotification

LipstickNotification *createNotification(uint id, Urgency urgency = Normal)
{
    QVariantHash hints;
    hints.insert(NotificationManager::HINT_PREVIEW_SUMMARY, "summary");
    hints.insert(NotificationManager::HINT_PREVIEW_BODY, "body");
    hints.insert(NotificationManager::HINT_URGENCY, static_cast<int>(urgency));
    LipstickNotification *notification = new LipstickNotification("ut_notificationpreviewpresenter", id, "", "", "", QStringList(), hints, -1);
    notificationManagerNotification.insert(id, notification);
    return notification;
}
开发者ID:pgerdt,项目名称:lipstick,代码行数:10,代码来源:ut_notificationpreviewpresenter.cpp

示例10:

LipstickNotification *createNotification(uint id, int urgency = 0)
{
    LipstickNotification *notification = new LipstickNotification;
    QVariantHash hints;
    hints.insert(NotificationManager::HINT_PREVIEW_SUMMARY, "summary");
    hints.insert(NotificationManager::HINT_PREVIEW_BODY, "body");
    hints.insert(NotificationManager::HINT_URGENCY, urgency);
    notification->setHints(hints);
    notificationManagerNotification.insert(id, notification);
    return notification;
}
开发者ID:SamuelNevala,项目名称:lipstick,代码行数:11,代码来源:ut_notificationpreviewpresenter.cpp

示例11: setClientInfo

void JSoftwareDetection::setClientInfo(JContactResource *resource, const QString &client, const QString &icon)
{
	QVariantHash clientInfo;
	ExtensionIcon extIcon(icon);
	clientInfo.insert("id", "client");
	clientInfo.insert("title", tr("Possible client"));
	clientInfo.insert("icon", QVariant::fromValue(extIcon));
	clientInfo.insert("description", client);
	clientInfo.insert("priority", 85);
	resource->setExtendedInfo("client", clientInfo);
}
开发者ID:akahan,项目名称:qutim,代码行数:11,代码来源:jsoftwaredetection.cpp

示例12: getCurrentData

QVariantHash WeatherDataWidget::getCurrentData()
{
    QVariantHash data;
    if(m_data)
    {
        data.insert("currentTemp", formatTemperatureString(m_data->currentTemp(), m_globalSettings->temperatureFormat()));
        data.insert("currentCity", m_data->currentCity());
        data.insert("currentImage", iconNameToPixmap(m_data->icon()).mid(1));
    }
    return data;
}
开发者ID:dgerlach,项目名称:Thermostat-Demo,代码行数:11,代码来源:weatherdatawidget.cpp

示例13:

LipstickNotification *createNotification(uint id, int urgency = 0)
{
    LipstickNotification *notification = new LipstickNotification;
    QVariantHash hints;
    hints.insert(NotificationManager::HINT_FEEDBACK, "feedback");
    hints.insert(NotificationManager::HINT_URGENCY, urgency);
    notification->setHints(hints);
    notificationManagerNotification.insert(id, notification);
    gNotificationPreviewPresenterStub->stubSetReturnValue("notification", notification);
    return notification;
}
开发者ID:Morpog,项目名称:lipstick,代码行数:11,代码来源:ut_notificationfeedbackplayer.cpp

示例14: makePersistent

void ScanFoldersModel::makePersistent()
{
    QVariantHash dirs;

    for (const PathData *pathData : asConst(m_pathList)) {
        if (pathData->downloadType == CUSTOM_LOCATION)
            dirs.insert(Utils::Fs::fromNativePath(pathData->watchPath), Utils::Fs::fromNativePath(pathData->downloadPath));
        else
            dirs.insert(Utils::Fs::fromNativePath(pathData->watchPath), pathData->downloadType);
    }

    Preferences::instance()->setScanDirs(dirs);
}
开发者ID:paolo-sz,项目名称:qBittorrent,代码行数:13,代码来源:scanfoldersmodel.cpp

示例15: eventFilter

	bool JPersonTuneRegistrator::eventFilter(QObject *obj, QEvent *ev)
	{
		if (ev->type() == ExtendedInfosEvent::eventType() && obj == JProtocol::instance()) {
			ExtendedInfosEvent *event = static_cast<ExtendedInfosEvent*>(ev);
			QVariantHash extStatus;
			extStatus.insert("id", "tune");
			extStatus.insert("name", QT_TRANSLATE_NOOP("Tune", "Tune").toString());
			extStatus.insert("settingsDescription",
							 QT_TRANSLATE_NOOP("Tune", "Show tune icon").toString());
			event->addInfo("tune", extStatus);
		}
		return false;
	}
开发者ID:CyberSys,项目名称:qutim,代码行数:13,代码来源:jpersontuneconverter.cpp


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