ContactDetails QML Type
ContactDetails 유형은 Place...에 대한 연락처 세부 정보를 보유합니다.. ..
Import Statement: | import QtLocation 6.8 |
Since: | QtLocation 5.5 |
메서드
- variant keys()
상세 설명
ContactDetails 유형은 contactDetail 개체의 맵입니다. 맵의 연락처 세부정보에 액세스하려면 keys() 메서드를 사용하여 맵에 저장된 키 목록을 가져온 다음 []
연산자를 사용하여 contactDetail 항목에 액세스합니다.
다음 키는 API에 정의되어 있습니다. Plugin 구현은 추가 키를 자유롭게 정의할 수 있습니다.
- 전화
- fax
- 이메일
- 웹사이트
ContactDetails 인스턴스는 Places 의 컨텍스트에서만 사용됩니다. ContactDetails 인스턴스를 직접 만들거나 Places 에 ContactDetails 인스턴스를 재할당할 수 없습니다. ContactDetails의 수정은 자바스크립트를 통해서만 수행할 수 있습니다.
예제
다음 예는 모든 contact details 에 액세스하여 콘솔에 인쇄하는 방법을 보여줍니다:
import QtPositioning import QtLocation function printContactDetails(contactDetails) { var keys = contactDetails.keys(); for (var i = 0; i < keys.length; ++i) { var contactList = contactDetails[keys[i]]; for (var j = 0; j < contactList.length; ++j) { console.log(contactList[j].label + ": " + contactList[j].value); } } }
반환된 연락처 세부 정보 목록은 객체 목록이므로 데이터 모델로 바로 사용할 수 있습니다. 예를 들어 다음은 목록 보기에 연락처 전화번호 목록을 표시하는 방법을 보여줍니다:
import QtQuick import QtPositioning import QtLocation ListView { model: place.contactDetails.phone; delegate: Text { text: modelData.label + ": " + modelData.value } }
다음 예는 자바스크립트에서 단일 전화번호를 장소에 할당하는 방법을 보여줍니다:
function writeSingle() { var phoneNumber = Qt.createQmlObject('import QtLocation; ContactDetail {}', place); phoneNumber.label = "Phone"; phoneNumber.value = "555-5555" place.contactDetails.phone = phoneNumber; }
다음은 자바스크립트에서 한 장소에 여러 전화번호를 할당하는 방법을 보여줍니다:
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; }
메서드 문서
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.