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


C++ QVariantHash类代码示例

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


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

示例1: QFETCH

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: qWarning

  void RepeatingBulkRound::IncomingData(const Request &notification)
  {
    if(Stopped()) {
      qWarning() << "Received a message on a closed session:" << ToString();
      return;
    }

    QSharedPointer<Connections::IOverlaySender> sender =
      notification.GetFrom().dynamicCast<Connections::IOverlaySender>();
    if(!sender) {
      qDebug() << ToString() << " received wayward message from: " <<
        notification.GetFrom()->ToString();
      return;
    }

    const Id &id = sender->GetRemoteId();
    if(!GetGroup().Contains(id)) {
      qDebug() << ToString() << " received wayward message from: " << 
        notification.GetFrom()->ToString();
      return;
    }

    QVariantHash msg = notification.GetData().toHash();

    bool bulk = msg.value("bulk").toBool();
    if(bulk) {
      ProcessData(id, msg.value("data").toByteArray());
    } else {
      _shuffle_round->IncomingData(notification);
    }
  }
开发者ID:ASchurman,项目名称:Dissent,代码行数:31,代码来源:RepeatingBulkRound.cpp

示例3: T_TRACEFUNC

/*!
  \~english
  Returns the rendering data of the partial template given by \a templateName.

  \~japanese
  部分テンプレート \a templateName に変数 \a vars を設定した描画データを返す
*/
QString TActionController::getRenderingData(const QString &templateName, const QVariantHash &vars)
{
    T_TRACEFUNC("templateName: %s", qPrintable(templateName));

    // Creates view-object
    QStringList names = templateName.split("/");
    if (names.count() != 2) {
        tError("Invalid patameter: %s", qPrintable(templateName));
        return QString();
    }

    TDispatcher<TActionView> viewDispatcher(viewClassName(names[0], names[1]));
    TActionView *view = viewDispatcher.object();
    if (!view) {
        return QString();
    }

    QVariantHash hash = allVariants();
    for (QHashIterator<QString, QVariant> i(vars); i.hasNext(); ) {
        i.next();
        hash.insert(i.key(), i.value()); // item's value of same key is replaced
    }

    view->setController(this);
    view->setVariantHash(hash);
    return view->toString();  
}
开发者ID:deniskin82,项目名称:treefrog-framework,代码行数:34,代码来源:tactioncontroller.cpp

示例4: priority

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

示例5: handleInfo

void Keyboard::handleInfo(QVariant const& properties)
{
    bool ok = false;
    QVariantHash items = properties.toHash();
    QString newSize = items[QString::fromLatin1("size")].toString();
    QVariantHash locale = items[QString::fromLatin1("locale")].toHash();

    int intSize = newSize.toInt(&ok);

    if (!locale.isEmpty())
    {
        QString languageId = locale[QString::fromLatin1("languageId")].toString();
        QString countryId = locale[QString::fromLatin1("countryId")].toString();

        if (!languageId.isEmpty())
            mLanguageId = languageId;

        if (!countryId.isEmpty())
            mCountryId = countryId;
    }

    if (ok && intSize != mKeyboardHeight) {
        mKeyboardHeight = intSize;
        emit notifyHeightChanged(mKeyboardHeight);
    }

#ifdef PPS_KEYBOARD_DEBUG
    qDebug() << "Keyboard: height:" << mKeyboardHeight << " languageId:" << mLanguageId
             << " countryId:" << mCountryId;
#endif

}
开发者ID:BGmot,项目名称:Qt,代码行数:32,代码来源:keyboard.cpp

示例6: saveSessionExpires

void SessionPrivate::_q_saveSession(Context *c)
{
    // fix cookie before we send headers
    saveSessionExpires(c);

    // Force extension of session_expires before finalizing headers, so a pos
    // up to date. First call to session_expires will extend the expiry, methods
    // just return the previously extended value.
    Session::expires(c);

    // Persist data
    static Session *session = c->plugin<Session*>();
    if (!session) {
        qCCritical(C_SESSION) << "Session plugin not registered";
        return;
    }
    saveSessionExpires(c);

    if (!c->property(SESSION_UPDATED).toBool()) {
        return;
    }
    SessionStore *store = session->d_ptr->store;
    QVariantHash sessionData = c->property(SESSION_VALUES).toHash();
    sessionData.insert(QStringLiteral("__updated"), QDateTime::currentMSecsSinceEpoch() / 1000);

    const QString sid = c->property(SESSION_ID).toString();
    store->storeSessionData(c, sid,  QStringLiteral("session"), sessionData);
}
开发者ID:buschmann23,项目名称:cutelyst,代码行数:28,代码来源:session.cpp

示例7: QueuedError

/**
 * @fn editTaskPrivate
 */
QueuedResult<bool> QueuedCorePrivateHelper::editTaskPrivate(QueuedProcess *_process,
                                                            const QVariantHash &_taskData,
                                                            const int _userId)
{
    qCDebug(LOG_LIB) << "Edit task with ID" << _process->index() << "from" << _userId;

    // modify record in database first
    bool status = database()->modify(QueuedDB::TASKS_TABLE, _process->index(), _taskData);
    if (!status) {
        qCWarning(LOG_LIB) << "Could not modify task record" << _process->index()
                           << "in database, do not edit it in memory";
        return QueuedError("", QueuedEnums::ReturnStatus::Error);
    }
    // store modification
    for (auto &field : _taskData.keys())
        database()->add(QueuedDB::TASKS_MODS_TABLE,
                        {{"task", _process->index()},
                         {"time", QDateTime::currentDateTimeUtc().toString(Qt::ISODateWithMs)},
                         {"user", _userId},
                         {"field", field},
                         {"value", _taskData[field]}});

    // modify values stored in memory
    for (auto &property : _taskData.keys())
        _process->setProperty(qPrintable(property), _taskData[property]);
    // notify plugins
    if (plugins())
        emit(plugins()->interface()->onEditTask(_process->index(), _taskData));

    return true;
}
开发者ID:arcan1s,项目名称:queued,代码行数:34,代码来源:QueuedCorePrivateHelper.cpp

示例8: renderBooks

void BookWindow::renderBooks() const
{
    int rows = model->rowCount();
    QVariantHash mapping;
    QVariantList bookList;
    for (int row = 0; row < rows; ++row)
    {
      QString title = model->index(row, 1).data().toString();
      QString author = model->index(row, 2).data().toString();
      QString genre = model->index(row, 3).data().toString();
      int rating = model->index(row, 5).data().toInt();
      QObject *book = new BookWrapper(author, title, genre, rating, this);
      QVariant var = QVariant::fromValue(book);
      bookList.append(var);
    }
    mapping.insert("books", bookList);

    QString themeName = ui.exportTheme->currentText();

    Grantlee::Context c(mapping);

    Grantlee::Template t = m_engine->loadByName( themeName + ".html" );
    if (!t)
    {
      QMessageBox::critical(this, "Unable to load template",
                QString( "Error loading template: %1" ).arg( themeName + ".html" ) );
      return;
    }

    if ( t->error() )
    {
      QMessageBox::critical(this, "Unable to load template",
                QString( "Error loading template: %1" ).arg( t->errorString() ) );
      return;
    }

    bool ok;
    QString text = QInputDialog::getText(this, tr("Export Location"),
                                         tr("file name:"), QLineEdit::Normal,
                                         QDir::home().absolutePath() + "/book_export.html", &ok);
    if (!ok || text.isEmpty())
      return;

    QFile file( text );
    if ( !file.open( QIODevice::WriteOnly | QIODevice::Text ) )
      return;

    QString content = t->render(&c);

    if ( t->error() )
    {
      QMessageBox::critical(this, "Unable render template",
                QString( "Error rendering template: %1" ).arg( t->errorString() ) );
      return;
    }

    file.write(content.toLocal8Bit());
    file.close();

}
开发者ID:saeschdivara,项目名称:Qt-Grantlee,代码行数:60,代码来源:bookwindow.cpp

示例9: fromVariant

bool ZrpcResponsePacket::fromVariant(const QVariant &in)
{
	if(in.type() != QVariant::Hash)
		return false;

	QVariantHash obj = in.toHash();

	if(!obj.contains("id") || obj["id"].type() != QVariant::ByteArray)
		return false;
	id = obj["id"].toByteArray();

	if(!obj.contains("success") || obj["success"].type() != QVariant::Bool)
		return false;
	success = obj["success"].toBool();

	value.clear();
	condition.clear();
	if(success)
	{
		if(!obj.contains("value"))
			return false;
		value = obj["value"];
	}
	else
	{
		if(!obj.contains("condition") || obj["condition"].type() != QVariant::ByteArray)
			return false;
		condition = obj["condition"].toByteArray();
	}

	return true;
}
开发者ID:aedrish,项目名称:projecten_server1,代码行数:32,代码来源:zrpcresponsepacket.cpp

示例10: notifyCall

void Tohkbd::notificationSend(QString summary, QString body)
{

    QDBusInterface notifyCall("org.freedesktop.Notifications", "/org/freedesktop/Notifications", "");

    QVariantHash hints;
    hints.insert("x-nemo-preview-summary", summary);

    QList<QVariant> args;
    args.append("tohkbd2");
    args.append(ssNotifyReplacesId);
    args.append("icon-m-notifications");
    args.append(summary);
    args.append(body);
    args.append((QStringList() << "default" << ""));
    args.append(hints);
    args.append(-1);

    QDBusMessage notifyCallReply = notifyCall.callWithArgumentList(QDBus::AutoDetect, "Notify", args);

    QList<QVariant> outArgs = notifyCallReply.arguments();

    ssNotifyReplacesId = outArgs.at(0).toInt();

    printf("Notification sent, got id %d\n", ssNotifyReplacesId);
}
开发者ID:ljo,项目名称:tohkbd2,代码行数:26,代码来源:tohkeyboard.cpp

示例11: writeMapping

QByteArray FSTReader::writeMapping(const QVariantHash& mapping) {
    static const QStringList PREFERED_ORDER = QStringList() << NAME_FIELD << TYPE_FIELD << SCALE_FIELD << FILENAME_FIELD
    << TEXDIR_FIELD << JOINT_FIELD << FREE_JOINT_FIELD
    << BLENDSHAPE_FIELD << JOINT_INDEX_FIELD;
    QBuffer buffer;
    buffer.open(QIODevice::WriteOnly);
    
    for (auto key : PREFERED_ORDER) {
        auto it = mapping.find(key);
        if (it != mapping.constEnd()) {
            if (key == FREE_JOINT_FIELD) { // writeVariant does not handle strings added using insertMulti.
                for (auto multi : mapping.values(key)) {
                    buffer.write(key.toUtf8());
                    buffer.write(" = ");
                    buffer.write(multi.toByteArray());
                    buffer.write("\n");
                }
            } else {
                writeVariant(buffer, it);
            }
        }
    }
    
    for (auto it = mapping.constBegin(); it != mapping.constEnd(); it++) {
        if (!PREFERED_ORDER.contains(it.key())) {
            writeVariant(buffer, it);
        }
    }
    return buffer.data();
}
开发者ID:cozza13,项目名称:hifi,代码行数:30,代码来源:FSTReader.cpp

示例12: codaIncreaseProgress

void SymbianIDeviceConfigurationWidget::getRomInfoResult(const Coda::CodaCommandResult &result)
{
    codaIncreaseProgress();
    if (result.type == Coda::CodaCommandResult::SuccessReply && result.values.count()) {
        startTable(m_deviceInfo);
        QTextStream str(&m_deviceInfo);

        QVariantHash obj = result.values[0].toVariant().toHash();
        QString romVersion = obj.value(QLatin1String("romVersion"), tr("unknown")).toString();
        romVersion.replace(QLatin1Char('\n'), QLatin1Char(' ')); // The ROM string is split across multiple lines, for some reason.
        addToTable(str, tr("ROM version:"), romVersion);

        QString pr = obj.value(QLatin1String("prInfo")).toString();
        if (pr.length())
            addToTable(str, tr("Release:"), pr);
        finishTable(m_deviceInfo);
    }

    QList<quint32> packagesOfInterest;
    packagesOfInterest.append(CODA_UID);
    packagesOfInterest.append(QTMOBILITY_UID);
    packagesOfInterest.append(QTCOMPONENTS_UID);
    packagesOfInterest.append(QMLVIEWER_UID);
    if (m_codaInfoDevice)
        m_codaInfoDevice->sendSymbianInstallGetPackageInfoCommand(Coda::CodaCallback(this, &SymbianIDeviceConfigurationWidget::getInstalledPackagesResult), packagesOfInterest);
}
开发者ID:gaoxiaojun,项目名称:qtcreator,代码行数:26,代码来源:symbianideviceconfigwidget.cpp

示例13: properties

bool ModelPackager::editProperties() {
    // open the dialog to configure the rest
    ModelPropertiesDialog properties(_mapping, _modelFile.path(), *_hfmModel);
    if (properties.exec() == QDialog::Rejected) {
        return false;
    }
    _mapping = properties.getMapping();

    // Make sure that a mapping for the root joint has been specified
    QVariantHash joints = _mapping.value(JOINT_FIELD).toHash();
    if (!joints.contains("jointRoot")) {
        qWarning() << "root joint not configured for skeleton.";
        
        QString message = "Your did not configure a root joint for your skeleton model.\n\nPackaging will be canceled.";
        QMessageBox msgBox;
        msgBox.setWindowTitle("Model Packager");
        msgBox.setText(message);
        msgBox.setStandardButtons(QMessageBox::Ok);
        msgBox.setIcon(QMessageBox::Warning);
        msgBox.exec();
        
        return false;
    }
    
    return true;
}
开发者ID:Nex-Pro,项目名称:hifi,代码行数:26,代码来源:ModelPackager.cpp

示例14: tLog

void
HatchetAccountConfig::login()
{
    tLog() << Q_FUNC_INFO;
    const ButtonAction action = static_cast< ButtonAction>( m_ui->loginButton->property( "action" ).toInt() );

    if ( action == Login )
    {
        // Log in mode
        tLog() << Q_FUNC_INFO << "Logging in...";
        m_account->loginWithPassword( m_ui->usernameEdit->text(), m_ui->passwordEdit->text(), m_ui->otpEdit->text() );
    }
    else if ( action == Logout )
    {
        // TODO
        m_ui->usernameEdit->clear();
        m_ui->passwordEdit->clear();
        m_ui->otpEdit->clear();

        QVariantHash creds = m_account->credentials();
        creds.clear();
        m_account->setCredentials( creds );
        m_account->sync();
        m_account->deauthenticate();
    }
}
开发者ID:aloktripathy,项目名称:tomahawk,代码行数:26,代码来源:HatchetAccountConfig.cpp

示例15: 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


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