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


C++ QVariantMap::contains方法代码示例

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


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

示例1: UpdateList

void save_data_list_dialog::UpdateList()
{
	m_list->clearContents();
	m_list->setRowCount((int)m_save_entries.size());

	QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();

	int row = 0;
	for (const SaveDataEntry& entry: m_save_entries)
	{
		QString title = qstr(entry.title);
		QString subtitle = qstr(entry.subtitle);
		QString dirName = qstr(entry.dirName);

		QTableWidgetItem* titleItem = new QTableWidgetItem(title);
		titleItem->setData(Qt::UserRole, row); // For sorting to work properly
		titleItem->setFlags(titleItem->flags() & ~Qt::ItemIsEditable);

		m_list->setItem(row, 0, titleItem);
		QTableWidgetItem* subtitleItem = new QTableWidgetItem(subtitle);
		subtitleItem->setFlags(subtitleItem->flags() & ~Qt::ItemIsEditable);
		m_list->setItem(row, 1, subtitleItem);

		QTableWidgetItem* dirNameItem = new QTableWidgetItem(dirName);
		dirNameItem->setFlags(dirNameItem->flags() & ~Qt::ItemIsEditable);
		m_list->setItem(row, 2, dirNameItem);

		QTableWidgetItem* noteItem = new QTableWidgetItem();
		noteItem->setFlags(noteItem->flags() | Qt::ItemIsEditable);

		if (currNotes.contains(dirName))
		{
			noteItem->setText(currNotes[dirName].toString());
		}

		m_list->setItem(row, 3, noteItem);
		++row;
	}

	m_list->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
	m_list->verticalHeader()->resizeSections(QHeaderView::ResizeToContents);

	QSize tableSize = QSize
	(
		m_list->verticalHeader()->width() + m_list->horizontalHeader()->length() + m_list->frameWidth() * 2,
		m_list->horizontalHeader()->height() + m_list->verticalHeader()->length() + m_list->frameWidth() * 2
	);

	QSize preferredSize = minimumSize().expandedTo(sizeHint() - m_list->sizeHint() + tableSize);

	QSize maxSize = QSize(preferredSize.width(), static_cast<int>(QApplication::desktop()->screenGeometry().height()*.6));

	resize(preferredSize.boundedTo(maxSize));
}
开发者ID:AniLeo,项目名称:rpcs3,代码行数:54,代码来源:save_data_list_dialog.cpp

示例2: sExtensionStatusEvent

void AstSipPeer::sExtensionStatusEvent(const QVariantMap &event)
{
  if(event.contains("Status"))
  {
    bool ok = false;
    uint status = event.value("Status").toUInt(&ok);
    if(ok)
      _extStatus = (AsteriskManager::ExtStatus)status;
  }
  emit sigExtensionStatusEvent(this, event);
}
开发者ID:dwatson78,项目名称:Qt-Asterisk-Desktop,代码行数:11,代码来源:astsippeer.cpp

示例3: validate

bool SetTaskHandler::validate(QVariantMap task) {
	bool isValid = true;
	bool ok;
	try {
		if (task.contains("id")) {
			int v = task["id"].toString().toInt(&ok, 16);
			assert_ex(ok && 0 <= v && v <= 255, ValidationError(""));
		}
		if (task.contains("categories")) {
			QVariantMap categories = task["categories"].toMap();
			for (auto it = categories.begin(); it != categories.end(); it++) {
				int v = it.key().toInt(&ok, 16);
				assert_ex(ok && 0 <= v && v <= 255, ValidationError(""));
			}
		}
	} catch (ValidationError& e) {
		isValid = false;
	}
	return isValid;
}
开发者ID:shilohchi,项目名称:PacketCapture,代码行数:20,代码来源:SetTaskHandler.cpp

示例4: estimateStealthLink

QVariant EstimateProfileOperationCommand::estimateStealthLink(const QVariantMap &request)
{
    if(!request.contains("uri"))
    {
        return makeFeeObject(BigInt(136000), request);
    }
    else
    {
        return makeFeeObject(estimateEdit(request["uri"].toString(), "payments", request["stealth"].toString()), request);
    }
}
开发者ID:BitProfile,项目名称:Xeth,代码行数:11,代码来源:EstimateProfileOperationCommand.cpp

示例5: on_server_usersChanged

void ClientWindow::on_server_usersChanged(QVariantList users)
{
    listWidgetUsers->clear();
    foreach (QVariant v, users) {
        QVariantMap map = v.toMap();
        QListWidgetItem *item = new QListWidgetItem(map["username"].toString());

        if(map.contains("avator"))
            item->setIcon(QIcon(map["avator"].value<QPixmap>()));
        listWidgetUsers->addItem(item);
    }
开发者ID:HamedMasafi,项目名称:Noron,代码行数:11,代码来源:clientwindow.cpp

示例6: greeterPropertiesChanged

void GreeterStatus::greeterPropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated)
{
    Q_UNUSED(invalidated);

    if (interface == "com.canonical.UnityGreeter") {
        if (changed.contains("IsActive")) {
            m_greeterActive = changed.value("IsActive").toBool();
            Q_EMIT greeterActiveChanged();
        }
    }
}
开发者ID:cherojeong,项目名称:ubuntu-keyboard,代码行数:11,代码来源:greeterstatus.cpp

示例7: sDndStatusEvent

void AstSipPeer::sDndStatusEvent(const QVariantMap &event)
{
  if(event.contains("Status"))
  {
    uint statusNum = event.value("Status").toUInt();
    AsteriskManager::ExtStatuses statuses(statusNum);
    _isDndOn = !statuses.testFlag(AsteriskManager::NotInUse);
    emit sUpdated(this);
    emit sigDndStatusEvent(this, event, _isDndOn);
  }
}
开发者ID:dwatson78,项目名称:Qt-Asterisk-Desktop,代码行数:11,代码来源:astsippeer.cpp

示例8: prepareForErrorDetails

// ----------------------------------------------------------------------------
// SifUiDialog::prepareForErrorDetails()
// ----------------------------------------------------------------------------
//
void SifUiDialog::prepareForErrorDetails(const QVariantMap &parameters)
{
    if (parameters.contains(KSifUiErrorDetails)) {
        mErrorDetails = parameters.value(KSifUiErrorDetails).toString();
    }
    if (parameters.contains(KSifUiErrorCode)) {
        bool ok = false;
        int errorCode = parameters.value(KSifUiErrorCode).toInt(&ok);
        if (ok) {
            mErrorCode = errorCode;
        }
    }
    if (parameters.contains(KSifUiErrorCodeExtended)) {
        bool ok = false;
        int errorCode = parameters.value(KSifUiErrorCodeExtended).toInt(&ok);
        if (ok) {
            mExtendedErrorCode = errorCode;
        }
    }
}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:24,代码来源:sifuidialog.cpp

示例9: updateStatus

bool PhoneInfo::updateStatus(const QVariantMap & prop)
{
    bool haschanged = false;
    haschanged |= setIfChangeString(prop, "hintstatus", & m_hintstatus);
    if (prop.contains("channels")) {
        m_channels = prop.value("channels").toStringList();
        m_xchannels.clear();
        foreach (QString channel, m_channels) {
            QString xchannel = QString("%1/%2").arg(m_ipbxid).arg(channel);
            m_xchannels.append(xchannel);
        }
开发者ID:namjae,项目名称:xivo-client-qt,代码行数:11,代码来源:phoneinfo.cpp

示例10: QDateTime

CPB::AutoSendEventData CPB::AutoSendEventData::parseMap(const QVariantMap &objMap, bool &valid)
{
    AutoSendEventData obj;

    if(objMap.contains("type") && objMap.contains("content")
            && objMap.contains("dateTime"))
    {
        Z_DEFINE_PARSE_VALUE_FOR_INT(obj,objMap,type);
        Z_DEFINE_PARSE_VALUE_FOR_STRING(obj,objMap,content);
        QDateTime dateTime = QDateTime::fromString(objMap.value("dateTime").toString(),"yyyyMMdd hh:mm:ss");
        if(!dateTime.isValid() || dateTime.isNull())
        {
            dateTime = QDateTime::fromString(objMap.value("dateTime").toString(),"yyyy-MM-dd hh:mm:ss");
        }
        if(!dateTime.isValid() || dateTime.isNull())
        {
            QDate date = QDate::fromString(objMap.value("dateTime").toString(),"yyyy-MM-dd");
            if(date.isValid() && !date.isNull())
            {
                dateTime = QDateTime(date,QTime(0,0,0));
            }
        }

        if(dateTime.isValid() && !dateTime.isNull())
        {
            valid = true;
            obj.dateTime = dateTime.toTime_t();
        }
        else
        {
            ZW_LOG_WARNING(QString("dateTime is error value=%1").arg(objMap.value("dateTime").toString()));
        }
    }
    else
    {
        ZW_LOG_WARNING(QString("keys not complete"));
        valid = false;
    }

    return obj;
}
开发者ID:weinkym,项目名称:src_miao,代码行数:41,代码来源:zpublic.cpp

示例11: makeRule

RulePtr Grammar::makeRule(const QVariantMap& ruleData) const
{
    RulePtr rule(new RuleData);

    rule->name = ruleData.value("name").toString();
    if (ruleData.contains("contentName"))
        rule->contentName = ruleData.value("contentName").toString();
    else
        rule->contentName = rule->name;
    rule->includeName = ruleData.value("include").toString();
    if (ruleData.contains("begin")) {
        rule->beginPattern = ruleData.value("begin").toString();
        rule->begin.setPattern(rule->beginPattern);
    }
    if (ruleData.contains("end")) {
        rule->endPattern = ruleData.value("end").toString();
    }
    if (ruleData.contains("match")) {
        rule->matchPattern = ruleData.value("match").toString();
        rule->match.setPattern(rule->matchPattern);
    }
    QVariant ruleListData = ruleData.value("patterns");
    if (ruleListData.isValid()) {
        rule->patterns = makeRuleList(ruleListData.toList());
    }

    QVariant capturesData = ruleData.value("captures");
    rule->captures = makeCaptures(capturesData.toMap());
    QVariant beginCapturesData = ruleData.value("beginCaptures");
    if (beginCapturesData.isValid())
        rule->beginCaptures = makeCaptures(beginCapturesData.toMap());
    else
        rule->beginCaptures = rule->captures;
    QVariant endCapturesData = ruleData.value("endCaptures");
    if (endCapturesData.isValid())
        rule->endCaptures = makeCaptures(endCapturesData.toMap());
    else
        rule->endCaptures = rule->captures;

    return rule;
}
开发者ID:ropez,项目名称:textlite,代码行数:41,代码来源:grammar.cpp

示例12: tr

DigitallyImportedClient::AuthReply
DigitallyImportedClient::ParseAuthReply(QNetworkReply* reply) const {
  AuthReply ret;
  ret.success_ = false;
  ret.error_reason_ = tr("Unknown error");

  const int http_status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
  if (http_status == 403) {
    ret.error_reason_ = reply->readAll();
    return ret;
  } else if (http_status != 200) {
    return ret;
  }

  QJson::Parser parser;
  QVariantMap data = parser.parse(reply).toMap();

  if (!data.contains("subscriptions")) {
    return ret;
  }

  QVariantList subscriptions = data.value("subscriptions", QVariantList()).toList();
  if (subscriptions.isEmpty() ||
      subscriptions[0].toMap().value("status").toString() != "active") {
    ret.error_reason_ = tr("You do not have an active subscription");
    return ret;
  }

  if (!data.contains("first_name") ||
      !data.contains("last_name") ||
      !subscriptions[0].toMap().contains("expires_on") ||
      !data.contains("listen_key"))
    return ret;

  ret.success_ = true;
  ret.first_name_ = data["first_name"].toString();
  ret.last_name_ = data["last_name"].toString();
  ret.expires_ = QDateTime::fromString(subscriptions[0].toMap()["expires_on"].toString(), Qt::ISODate);
  ret.listen_hash_ = data["listen_key"].toString();
  return ret;
}
开发者ID:BrummbQ,项目名称:Clementine,代码行数:41,代码来源:digitallyimportedclient.cpp

示例13: upgrade

void Preferences::upgrade()
{
    QStringList labels = value("TransferListFilters/customLabels").toStringList();
    if (!labels.isEmpty()) {
        QVariantMap categories = value("BitTorrent/Session/Categories").toMap();
        foreach (const QString &label, labels) {
            if (!categories.contains(label))
                categories[label] = "";
        }
        setValue("BitTorrent/Session/Categories", categories);
        SettingsStorage::instance()->removeValue("TransferListFilters/customLabels");
    }
开发者ID:Gelmir,项目名称:qBittorrent,代码行数:12,代码来源:preferences.cpp

示例14: add

void Server::add(const QVariantMap& entry) {
	CHECK_PARAM_RET(entry.contains(KEY));
	const QString& sKey = entry.value(KEY).toString();
	CHECK_PARAM_RET(!sKey.isEmpty());

	m_database.insert(sKey, entry);

	qDebug() << "database:";
	qDebug() << m_database;

	emit entryAdded(entry);
}
开发者ID:ellis,项目名称:gcead,代码行数:12,代码来源:Server.cpp

示例15: saveLocation

void NotificationThread::processIP1(QByteArray const& data)
{
    QVariantMap result = bb::data::JsonDataAccess().loadFromBuffer(data).toMap();

    if ( result.contains("latitude") && result.contains("longitude") )
    {
        qreal latitude = result.value("latitude").toReal();
        qreal longitude = result.value("longitude").toReal();
        QString country = result.value("country").toString();
        QString city = result.value("city").toString();
        QString region = result.value("region").toString();

        saveLocation(country, city, latitude, longitude, region);
    } else if ( m_network.online() ) {
        m_network.doGet( QUrl("http://www.freegeoip.net/csv/"), COOKIE_IP2_FETCH); // try a different provider
        AppLogFetcher::getInstance()->record("FailedIP1FetchIP2");
    } else {
        LOGGER("OfflineDontFetchIP2");
        AppLogFetcher::getInstance()->record("OfflineDontFetchIP2");
    }
}
开发者ID:canadainc,项目名称:salat10,代码行数:21,代码来源:NotificationThread.cpp


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