ExtendedAttributes QML Type

ExtendedAttributes型は、Place についての追加データを保持する。 ... 詳細

Import Statement: import QtLocation 6.8
Since: QtLocation 5.5
In C++: QQmlPropertyMap

シグナル

方法

詳細説明

ExtendedAttributes 型は、placeAttributes のマップです。マップ内の属性にアクセスするには、keys() メソッドを使用してマップに格納されているキーのリストを取得し、[] 演算子を使用してplaceAttribute 項目にアクセスします。

以下はAPIで定義されている標準的なキーである。Plugin 実装は自由に追加のキーを定義できる。カスタム・キーは、衝突を避けるために一意な接頭辞で修飾する必要があります。

キー説明
営業時間取引所の取引時間
支払い例えばビザやマスターカードなど。
x_プロバイダープレイスポットの提供元プロバイダー名
x_id_<プロバイダー> (例 x_id_here)指定されたプロバイダから見た場所を識別する代替識別子。

プラグインによっては、属性をまったくサポートしないものもあれば、特定のセットだけをサポートするものもあります。また、時間とともに動的に変化する属性をサポートしたり、クライアントアプリケーションによって任意に定義される属性をサポートするものもあります。例えば、ある店には営業時間があるが、別の店にはないといった具合です。詳しくはプラグインのリファレンスを参照してください。

属性の中には、エンド・ユーザーが読めるように意図されていないものもあります。そのような属性のラベル・フィールドは、この事実を示すために空です。

注意: ExtendedAttributesインスタンスは、Placesのコンテキストでのみ使用されます。ExtendedAttributesインスタンスを直接作成したり、Place'のExtendedAttributesプロパティを再割り当てしたりすることはできません。ExtendedAttributesの変更は、Javascriptを介してのみ行うことができます。

次の例では、すべてのplaceAttributes にアクセスし、コンソールに出力する方法を示します:

import QtPositioning
import QtLocation

function printExtendedAttributes(extendedAttributes) {
    var keys = extendedAttributes.keys();
    for (var i = 0; i < keys.length; ++i) {
        var key = keys[i];
        if (extendedAttributes[key].label !== "")
            console.log(extendedAttributes[key].label + ": " + extendedAttributes[key].text);
    }
}

次の例は、属性を割り当てて変更する方法を示しています:

    //assign a new attribute to a place
    var smokingAttrib = Qt.createQmlObject('import QtLocation; PlaceAttribute {}', place);
    smokingAttrib.label = "Smoking Allowed"
    smokingAttrib.text = "No"
    place.extendedAttributes.smoking = smokingAttrib;

    //modify an existing attribute
    place.extendedAttributes.smoking.text = "Yes"

placeAttributeQQmlPropertyMapも参照してください

シグナル・ドキュメント

void valueChanged(string key, variant value)

このシグナルは、属性のセットが変更されたときに発行されます。key は、変更されたvalue に対応するキーです。

対応するハンドラはonValueChanged です。

注意: 対応するハンドラはonValueChanged です。


メソッドの説明

variant keys()

現在マップに格納されている場所の属性キーの配列を返します。


© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.