contactDetail QML Value Type

contactDetail 类型用于保存电话号码或网站地址等详细联系信息。更多

Import Statement: import QtLocation 6.9
Since: QtLocation 5.5

属性

详细说明

contactDetail 提供了如何联系Place 的单个细节。contactDetail 由labelvalue 组成,前者是描述联系方法的本地化字符串,后者代表实际联系细节。

示例

下面的示例演示了如何在 JavaScript 中为一个地点分配一个电话号码:

function writeSingle() {
    var phoneNumber = Qt.createQmlObject('import QtLocation; ContactDetail {}', place);
    phoneNumber.label = "Phone";
    phoneNumber.value = "555-5555"
    place.contactDetails.phone = phoneNumber;
}

以下示例演示了如何在 JavaScript 中为一个地点分配多个电话号码:

function writeMultiple() {
    var bob = Qt.createQmlObject('import QtLocation; ContactDetail {}', place);
    bob.label = "Bob";
    bob.value = "555-5555"

    var alice = Qt.createQmlObject('import QtLocation; ContactDetail {}', place);
    alice.label = "Alice";
    alice.value = "555-8745"

    var numbers = new Array();
    numbers.push(bob);
    numbers.push(alice);

    place.contactDetails.phone = numbers;
}

注意,由于QQmlPropertyMap 的限制,无法在 QML 中声明指定联系人详细信息,只能通过 JavaScript 来实现。

属性文档

label : string

该属性包含描述联系人详细信息的标签。

该标签可以本地化。语言取决于设置它的实体,通常是PluginPlugin::locales 属性定义了使用的语言。


value : string

该属性包含联系人详细信息的值,可以是电话号码、电子邮件地址、网站 url 等。


© 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.