ContactDetails QML Type (Uncreatable)
ContactDetails 유형은 Place 의 연락처 정보를 저장합니다. 더 보기...
| Import Statement: | import QtLocation 6.12 |
| Since: | QtLocation 5.5 |
참고: 이 타입은 생성할 수 없는 타입입니다. QML에서 인스턴스화할 수 없습니다.
메서드
- variant keys()
상세 설명
ContactDetails 유형은 contactDetail 객체의 맵입니다. 맵에 저장된 연락처 세부 정보를 조회하려면 keys() 메서드를 사용하여 맵에 저장된 키 목록을 가져온 다음, [] 연산자를 사용하여 contactDetail 항목을 조회하십시오.
API에는 다음과 같은 키가 정의되어 있습니다. Plugin 구현체는 추가 키를 자유롭게 정의할 수 있습니다.
- phone
- fax
- website
ContactDetails 인스턴스는 Places 의 컨텍스트에서만 사용됩니다. ContactDetails 인스턴스를 직접 생성하거나 ContactDetails 인스턴스를 Places 에 재할당할 수는 없습니다. 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()
현재 맵에 저장된 연락처 세부 정보 키들의 배열을 반환합니다.
© 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.