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


C++ QVariantList函数代码示例

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


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

示例1: QStringLiteral

void DecorationTest::testCreate()
{
    // just test that creating the Decoration doesn't crash
    MockBridge bridge;
    const QString bridgeKey = QStringLiteral("bridge");
    MockDecoration deco1(nullptr, QVariantList({
#ifdef _MSC_VER
                                                makeMap(bridgeKey, QVariant::fromValue(5)),
#else
                                                QVariantMap({ {bridgeKey, QVariant::fromValue(5)} }),
#endif
                                                QVariant::fromValue(bridgeKey),
                                                QVariantMap(),
#ifdef _MSC_VER
                                                makeMap(bridgeKey, QVariant::fromValue(&bridge)),
#else
                                                QVariantMap({ {bridgeKey, QVariant::fromValue(&bridge)} })
#endif
                                               }));
    QVERIFY(!deco1.client().isNull());
}
开发者ID:KDE,项目名称:kdecoration,代码行数:21,代码来源:decorationtest.cpp

示例2: currentArguments

void ItemTagsScriptable::clearTags()
{
    const auto args = currentArguments();

    if ( args.isEmpty() ) {
        const auto dataValueList = call("selectedItemsData").toList();

        QVariantList dataList;
        for (const auto &itemDataValue : dataValueList) {
            auto itemData = itemDataValue.toMap();
            itemData.remove(mimeTags);
            dataList.append(itemData);
        }

        call( "setSelectedItemsData", QVariantList() << QVariant(dataList) );
    } else {
        const auto rows = this->rows(args, 0);
        for (int row : rows)
            setTags(row, QStringList());
    }
}
开发者ID:amosbird,项目名称:CopyQ,代码行数:21,代码来源:itemtags.cpp

示例3: sendCommand

void SpotifyIO::sendTrackEnd()
{
    int ms_played = mediaPlayer->duration();
    int ms_played_union = ms_played;
    int n_seeks_forward = 0;
    int n_seeks_backward = 0;
    int ms_seeks_forward = 0;
    int ms_seeks_backward = 0;
    int ms_latency = 100;
    bool display_track = false;
    QString play_context = "unknown";
    QString source_start = "unknown";
    QString source_end = "unknown";
    QString reason_start = "unknown";
    QString reason_end = "unknown";
    QString referrer = "unknown";
    QString referrer_version = "0.1.0";
    QString referrer_vendor = "com.spotify";
    int max_continuous = ms_played;
    sendCommand("sp/track_end",
                QVariantList()
                << mediaPlayer->getSession()
                << ms_played
                << ms_played_union
                << n_seeks_forward
                << n_seeks_backward
                << ms_seeks_forward
                << ms_seeks_backward
                << ms_latency
                << display_track
                << play_context
                << source_start
                << source_end
                << reason_start
                << reason_end
                << referrer
                << referrer_version
                << referrer_vendor
                << max_continuous);
}
开发者ID:CODeRUS,项目名称:spotacular,代码行数:40,代码来源:spotifyio.cpp

示例4: QVariantList

QVariantList CTransaction::structToJson()
{
    if(changing)
        return QVariantList();
    //changing = true;
    QList<ROBOT_DATA> tmpData = statusDataBuf;
    QVariantList list;
    for(int i = 0; i < tmpData.count(); i++){
        qDebug()<<"get data";
        robotStatusData * deviceData= new robotStatusData(tmpData.at(i));
        QVariantMap deviceMap = toVariantMap(deviceData);
        QVariant deviceJson = toJsonVariant(deviceMap);
        list.append(deviceJson);
        if(deviceData != NULL)
            delete deviceData;
        deviceData = NULL;
        qDebug()<<"get done";
    }
    tmpData.clear();
    //changing = false;
    return list;
}
开发者ID:YeChenzjg,项目名称:qt_HRG_robot_check,代码行数:22,代码来源:transaction.cpp

示例5: QVariantList

void LibraryUI::burnCurrentItem()
{
    QListWidgetItem *item = item_list->currentItem();
    if( item == 0 )
        return ;

    QString path = item->statusTip();

    SAboutData about;
    QList<SAboutData> apps_list = Silicon::appsList();
    for( int i=0 ; i<apps_list.count() ; i++ )
        if( apps_list[i].name() == "Copy Disc" )
        {
            about = apps_list[i];
            break;
        }

    if( about.name().isEmpty() )
        return ;

    Silicon::loadApp( about , QVariantList()<< path );
}
开发者ID:realbardia,项目名称:silicon,代码行数:22,代码来源:libraryui.cpp

示例6: GetFirstChildFolderByName

void WebDavInventoryDataModel::UploadBuffer(const QString &filename, QByteArray& buffer, AbstractInventoryItem *parent_folder)
{
    if (!parent_folder)
        parent_folder = GetFirstChildFolderByName("My Inventory");

    InventoryFolder *parentFolder = dynamic_cast<InventoryFolder *>(parent_folder);
    if (!parentFolder)
        return;

    QString parentPath = ValidateFolderPath(parentFolder->GetID());
    QStringList result = webdavclient_.call("uploadFileBuffer", QVariantList() << buffer << parentPath << filename).toStringList();
    if (result.count() >= 1)
    {
        if (result[0] == "True")
        {
            FetchInventoryDescendents(parent_folder);
            InventoryModule::LogInfo(QString("Webdav | Upload of file %1 to path %2%3 succeeded\n").arg(filename, parentPath, filename).toStdString());
        }
        else
            InventoryModule::LogInfo(QString("Webdav | Upload of file %1 to path %2%3 failed\n").arg(filename, parentPath, filename).toStdString());
    }
}
开发者ID:Belsepubi,项目名称:naali,代码行数:22,代码来源:WebdavInventoryDataModel.cpp

示例7: QVERIFY

void InstructionFactoryTest::testCreateCallAndAssignInstruction()
{
    QVariantList words;
    words << "id"
          << "callandassign"
          << "symbol"
          << "instance"
          << "method"
          << "arg1"
          << "arg2";

    Instruction *abstractInstruction = InstructionFactory::createInstruction(words);

    CallAndAssignInstruction *instruction = dynamic_cast<CallAndAssignInstruction*>(abstractInstruction);
    QVERIFY(instruction != nullptr);

    QCOMPARE(instruction->instructionId(), QString("id"));
    QCOMPARE(instruction->symbolName(), QString("symbol"));
    QCOMPARE(instruction->instanceName(), QString("instance"));
    QCOMPARE(instruction->methodName(), QString("method"));
    QCOMPARE(instruction->arguments(), QVariantList() << "arg1" << "arg2");
}
开发者ID:chgans,项目名称:QtSlim,代码行数:22,代码来源:tst_instructionfactory.cpp

示例8: ValidateFolderPath

void WebDavInventoryDataModel::DownloadFile(const QString &store_folder, AbstractInventoryItem *selected_item)
{
    InventoryAsset *item = dynamic_cast<InventoryAsset *>(selected_item);
    if (!item)
        return;

    QString storePath = store_folder;
    QString parentPath = ValidateFolderPath(item->GetParent()->GetID());
    QString filename = item->GetName();
    //emit DownloadStarted(id);
    QStringList result = webdavclient_.call("downloadFile", QVariantList() << storePath << parentPath << filename).toStringList();
    if (result.count() >= 1)
    {
        if (result[0] == "True")
        {
            InventoryModule::LogInfo(QString("Webdav | Downloaded file %1%2 to path %3\n").arg(parentPath, filename, storePath).toStdString());
            //emit DownloadCompleted(id);
        }
        else
            InventoryModule::LogInfo(QString("Webdav | Downloaded of file %1%2 to path %3 failed\n").arg(parentPath, filename, storePath).toStdString());
    }
}
开发者ID:Belsepubi,项目名称:naali,代码行数:22,代码来源:WebdavInventoryDataModel.cpp

示例9: dataFile

QVariantList DatasetParser::parseDataFile(QFileInfo dataFileInfo)
{
    QVariantList datasetDescriptor;
    QHash<int,int> instanceDescriptor;
    QHash<int,QString> classDescriptor;
    QFile dataFile(dataFileInfo.filePath());
    QString datasetDescriptionPlain;
    if (dataFile.open(QIODevice::ReadOnly))
        datasetDescriptionPlain = dataFile.readAll();
    else
    {
        qDebug(QString("Can't open file: %1").arg(dataFileInfo.absoluteFilePath()).toAscii());
        return QVariantList();
    }

    QStringList instanceDescriptionPlainList = datasetDescriptionPlain.split(instanceSeperator);
    QStringList headerList = instanceDescriptionPlainList.takeFirst().split(headerSeperator);
    int instanceUniqueIDIndex = headerList.indexOf(instanceUniqueIDHeader);
    int classNameIndex = headerList.indexOf(classNameHeader);
    int classIDIndex = headerList.indexOf(classIDHeader);

    foreach (QString instanceDescriptionPlain, instanceDescriptionPlainList)
    {
        QStringList instanceDescriptionList = instanceDescriptionPlain.split(headerSeperator);
        QString className = instanceDescriptionList[classNameIndex];
        int classID = instanceDescriptionList[classIDIndex].toInt();
        if (!classDescriptor[classID].isEmpty())
        {
            if (classDescriptor[classID] != className)
            {
                qDebug(QString("Class ID %1 is matched to classes with names %2 & %3").arg(classID).arg(classDescriptor[classIDIndex]).arg(className).toAscii());
            }
        }
        else
            classDescriptor[classID] = className;
        QString instanceUniqueID = instanceDescriptionList[instanceUniqueIDIndex];
        instanceDescriptor.unite(this->parseInstanceUniqueID(instanceUniqueID, classID));
    }
开发者ID:TinaSeifpoor,项目名称:repo,代码行数:38,代码来源:datasetparser.cpp

示例10: QString

QVariant MashouList::listAction() const
{
	QVariantList columns;
	columns << QString("id") << QString("name_en") << QString("name_ja")
		<< QString("icon") << QString("equip_type");

	QVariantMap orderby_equip_type;
	orderby_equip_type["column"] = "equip_type";
	orderby_equip_type["direction"] = "asc";

	QVariantMap orderby_id;
	orderby_id["column"] = "id";
	orderby_id["direction"] = "asc";

	QVariantMap action;
	action["action"] = QString("select");
	action["table"] = QString("db_mashou");
	action["columns"] = columns;
	action["order_by"] = QVariantList() << orderby_equip_type << orderby_id;
	action["user_data"] = listUserData();

	return action;
}
开发者ID:ArbalestX,项目名称:megatendb,代码行数:23,代码来源:MashouList.cpp

示例11: QVariant

QVariant Scripting::Account::actualEffortCostPrDay( const QVariant &start, const QVariant &end, const QVariant &schedule )
{
    //kDebug(planDbg())<<start<<end<<schedule;
    QVariantMap map;
    QDate s = start.toDate();
    QDate e = end.toDate();
    if ( ! s.isValid() ) {
        s = QDate::currentDate();
    }
    if ( ! e.isValid() ) {
        e = QDate::currentDate();
    }
    KPlato::Accounts *a = m_account->list();
    if ( a == 0 ) {
        return QVariant();
    }
    KPlato::EffortCostMap ec = a->actualCost( *m_account, s, e, schedule.toLongLong() );
    KPlato::EffortCostDayMap::ConstIterator it = ec.days().constBegin();
    for (; it != ec.days().constEnd(); ++it ) {
        map.insert( it.key().toString( Qt::ISODate ), QVariantList() << it.value().effort().toDouble( KPlato::Duration::Unit_h ) << it.value().cost() );
    }
    return map;
}
开发者ID:KDE,项目名称:calligra,代码行数:23,代码来源:Account.cpp

示例12: fromVariant

/*!
    Converts the value to a \l {QVariant::}{QVariant()}.

    The QJsonValue types will be converted as follows:

    \value Null     {QVariant::}{QVariant()}
    \value Bool     QMetaType::Bool
    \value Double   QMetaType::Double
    \value String   QString
    \value Array    QVariantList
    \value Object   QVariantMap
    \value Undefined {QVariant::}{QVariant()}

    \sa fromVariant()
 */
QVariant QJsonValue::toVariant() const
{
    switch (t) {
    case Bool:
        return b;
    case Double:
        return dbl;
    case String:
        return toString();
    case Array:
        return d ?
               QJsonArray(d, static_cast<QJsonPrivate::Array *>(base)).toVariantList() :
               QVariantList();
    case Object:
        return d ?
               QJsonObject(d, static_cast<QJsonPrivate::Object *>(base)).toVariantMap() :
               QVariantMap();
    case Null:
    case Undefined:
        break;
    }
    return QVariant();
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:38,代码来源:qjsonvalue.cpp

示例13: fi

void HttpConnection::processRequest()
{
	if(!m_getPath.isEmpty()) {
		if(!m_getPath.startsWith('/'))
			m_getPath = '/' + m_getPath;
		Application *app = Application::instance();
		AppCliOptions *cliopts = app->cliOptions();
		QString html_dir = cliopts->htmlDir();
		QFileInfo fi(html_dir + m_getPath);
		qfInfo() << "GET" << m_getPath << "abs:" << fi.absoluteFilePath();
		if(fi.isDir()) {
			if(!m_getPath.endsWith('/'))
				m_getPath += '/';
			QVariantList html_body = QVariantList() << QStringLiteral("body");
			QDir dir(fi.absoluteFilePath());
			QVariantList class_links;
			qfInfo() << "dir of:" << dir.absolutePath();
			for(const QString &fn : dir.entryList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) {
				class_links.insert(class_links.length(), QVariantList{"a", QVariantMap{{"href", m_getPath + fn}}, fn});
			}
			html_body.insert(html_body.length(), QVariantList{"p"} << class_links);

			qf::core::utils::HtmlUtils::FromHtmlListOptions opts;
			opts.setDocumentTitle(tr("Dir list %1").arg(m_getPath));
			QString html = qf::core::utils::HtmlUtils::fromHtmlList(html_body, opts);
			responseOK(html.toUtf8());
		}
		else {
			QFile f(fi.absoluteFilePath());
			if(f.open(QFile::ReadOnly)) {
				QByteArray ba = f.readAll();
				responseOK(ba);
			}
		}
	}
	m_socket->close();
}
开发者ID:Paukert,项目名称:quickbox,代码行数:37,代码来源:httpconnection.cpp

示例14: getenv

void PulseAudioControl::openConnection()
{
    //! If the connection already exists, do nothing
    if ((dbusConnection != NULL) && (dbus_connection_get_is_connected(dbusConnection))) {
        return;
    }

    // Establish a connection to the server
    char *pa_bus_address = getenv("PULSE_DBUS_SERVER");
    QByteArray addressArray;
    if (pa_bus_address == NULL) {
        QDBusMessage message = QDBusMessage::createMethodCall("org.pulseaudio.Server", "/org/pulseaudio/server_lookup1", "org.freedesktop.DBus.Properties", "Get");
        message.setArguments(QVariantList() << "org.PulseAudio.ServerLookup1" << "Address");
        QDBusMessage reply = QDBusConnection::sessionBus().call(message);
        if (reply.type() == QDBusMessage::ReplyMessage && reply.arguments().count() > 0) {
            addressArray = reply.arguments().first().value<QDBusVariant>().variant().toString().toAscii();
            pa_bus_address = addressArray.data();
        }
    }

    if (pa_bus_address != NULL) {
        DBusError dbus_err;
        dbus_error_init(&dbus_err);

        dbusConnection = dbus_connection_open(pa_bus_address, &dbus_err);

        DBUS_ERR_CHECK(dbus_err);
    }

    if (dbusConnection != NULL) {
        dbus_connection_setup_with_g_main(dbusConnection, NULL);
        dbus_connection_add_filter(dbusConnection, PulseAudioControl::stepsUpdatedSignalHandler, (void *)this, NULL);

        addSignalMatch();
    }
}
开发者ID:SamuelNevala,项目名称:lipstick,代码行数:36,代码来源:pulseaudiocontrol.cpp

示例15: QVariantList

DigitallyImportedClient::ChannelList DigitallyImportedClient::ParseChannelList(
    QNetworkReply* reply) const {
  ChannelList ret;

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

  if (!data.contains("channel_filters")) return ret;

  QVariantList filters = data["channel_filters"].toList();

  for (const QVariant& filter : filters) {
    // Find the filter called "All"
    QVariantMap filter_map = filter.toMap();
    if (filter_map.value("name", QString()).toString() != "All") continue;

    // Add all its stations to the result
    QVariantList channels =
        filter_map.value("channels", QVariantList()).toList();
    for (const QVariant& channel_var : channels) {
      QVariantMap channel_map = channel_var.toMap();

      Channel channel;
      channel.art_url_ = QUrl(channel_map.value("asset_url").toString());
      channel.description_ = channel_map.value("description").toString();
      channel.director_ = channel_map.value("channel_director").toString();
      channel.key_ = channel_map.value("key").toString();
      channel.name_ = channel_map.value("name").toString();
      ret << channel;
    }

    break;
  }

  return ret;
}
开发者ID:Gu1,项目名称:Clementine,代码行数:36,代码来源:digitallyimportedclient.cpp


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