ExtendedAttributes QML Type
ExtendedAttributes 型は、Place に関する追加データを保持します。詳細...
| Import Statement: | import QtLocation 6.12 |
| Since: | QtLocation 5.5 |
| In C++: | QQmlPropertyMap |
シグナル
- void valueChanged(string key, variant value)
方法
- variant keys()
詳細な説明
ExtendedAttributes型は、placeAttributes のマップです。マップ内の属性にアクセスするには、keys()メソッドを使用してマップに格納されているキーのリストを取得し、[] 演算子を使用してplaceAttribute の項目にアクセスします。
以下は、API によって定義されている標準的なキーです。Plugin の実装では、追加のキーを自由に定義できます。競合を避けるため、カスタムキーには一意のプレフィックスを付ける必要があります。
| key | 説明 |
|---|---|
| openingHours | その場所の営業時間 |
| payment | その施設で利用可能な支払い方法(例:Visa、Mastercardなど)。 |
| x_provider | その店舗が仕入先としているプロバイダーの名前 |
| x_id_<プロバイダー>(例:x_id_here) | 指定されたプロバイダーの観点からその場所を識別するための代替識別子。 |
プラグインによっては、属性をまったくサポートしていないものもあれば、特定のセットのみをサポートしているもの、時間の経過とともに動的に変化する属性セットをサポートしているもの、さらにはクライアントアプリケーションによる属性の任意の定義を許可しているものもあります。また、属性は場所ごとに異なる場合もあります。たとえば、ある場所には営業時間がある一方で、別の場所にはないといった具合です。 詳細については、プラグインのリファレンスを参照してください。
一部の属性は、エンドユーザーに表示されることを意図していない場合があります。そのような属性のラベルフィールドは、この事実を示すために空になっています。
注:ExtendedAttributes インスタンスは、Placeのコンテキスト内でのみ使用されます。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"「 placeAttribute 」および「QQmlPropertyMap 」も参照してください 。
Signal ドキュメント
void valueChanged(string key, variant value)
このシグナルは、属性のセットが変更されたときに発火します。key は、変更されたvalue に対応するキーです。
対応するハンドラはonValueChanged です。
注: 対応するハンドラは onValueChanged です。
メソッドのドキュメント
variant keys()
マップに現在格納されている「place」属性のキーの配列を返します。
© 2026 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.