本页内容

contactDetail QML Value Type

contactDetail 类型用于存储联系人详细信息,例如电话号码或网站地址。更多...

Import Statement: import QtLocation 6.12
Since: QtLocation 5.5

属性

详细说明

contactDetail 提供了一条关于如何联系Place 的详细信息。contactDetail 由label (描述联系方式的本地化字符串)和value (表示实际联系方式的对象)组成。

示例

以下示例演示了如何在 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

该属性包含一个描述联系信息的标签。

该标签可能需要本地化。其语言取决于设置该标签的实体,通常是Plugin 。Plugin::locales 属性定义了所使用的语言。

value : string

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

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