PlaceSearchSuggestionModel QML Type
검색어 제안에 대한 액세스를 제공합니다. 더 보기...
Import Statement: | import QtLocation 6.8 |
Since: | QtLocation 5.5 |
속성
- limit : int
- offset : int
- plugin : Plugin
- searchArea : geoshape
- searchTerm : string
- status : enum
- suggestions : stringlist
방법
- void cancel()
- string errorString()
- void reset()
- void update()
상세 설명
장소 검색 제안 모델은 사용자가 검색어를 입력할 때 검색어 제안을 제공하는 데 사용할 수 있습니다. 이 모델의 속성은 실제 검색 쿼리를 수행하는 데 사용되는 PlaceSearchModel 의 속성과 일치하여 검색 제안 결과가 관련성이 있는지 확인해야 합니다.
이 모델에서 제공하는 데이터에 액세스하는 방법에는 suggestions 속성 또는 보기 및 위임자를 통한 두 가지 방법이 있습니다. 후자가 선호되는 방법입니다.
offset 및 limit 속성을 사용하여 페이징된 제안에 액세스할 수 있습니다. offset 및 limit 속성을 설정하면 offset 및 (offset + limit - 1) 사이의 제안이 반환됩니다. 페이징에 대한 지원은 플러그인마다 다를 수 있습니다.
이 모델은 다음 역할에 대한 데이터를 반환합니다:
역할 | 유형 | 설명 |
---|---|---|
제안 | 문자열 | 추천 검색어입니다. |
다음 예는 장소 검색에서 추천 검색어를 가져오기 위해 장소 검색 제안 모델을 사용하는 방법을 보여줍니다. searchArea 은 실제 장소 검색을 수행하는 데 사용되는 PlaceSearchModel 과 일치하도록 설정되어 있습니다.
import QtQuick import QtPositioning import QtLocation PlaceSearchSuggestionModel { id: suggestionModel plugin: myPlugin // Brisbane searchArea: QtPositioning.circle(QtPositioning.coordinate(-27.46778, 153.02778)) onSearchTermChanged: update() } ListView { model: suggestionModel delegate: Text { text: suggestion } }
PlaceSearchModel 및 QPlaceManager 을참조하세요 .
속성 문서
searchArea : geoshape |
searchTerm : string |
이 속성은 쿼리에 사용된 부분 검색어를 보유합니다.
status : enum |
이 속성은 모델의 상태를 보유합니다. 다음 중 하나가 될 수 있습니다:
PlaceSearchSuggestionModel.Null | 검색 쿼리가 실행되지 않았습니다. 모델이 비어 있습니다. |
PlaceSearchSuggestionModel.Ready | 검색 쿼리가 완료되었으며 결과를 사용할 수 있습니다. |
PlaceSearchSuggestionModel.Loading | 검색 쿼리가 현재 실행 중입니다. |
PlaceSearchSuggestionModel.Error | 이전 검색 쿼리를 실행하는 동안 오류가 발생했습니다. |
suggestions : stringlist |
이 속성에는 현재 모델이 가지고 있는 예상 검색어 목록이 저장됩니다.
메서드 문서
void cancel() |
진행 중인 검색 제안 작업을 즉시 취소하고 모델 상태를 PlaceSearchSuggestionModel.Ready로 설정합니다. 모델은 작업을 시작하기 전에 가지고 있던 모든 검색 제안을 유지합니다.
작업이 진행 중이 아닌 경우 취소()를 호출해도 아무런 효과가 없습니다.
string errorString() |
이 읽기 전용 속성은 최신 검색 제안 모델 오류의 텍스트 표시를 보유합니다. 오류가 발생하지 않았거나 모델이 지워진 경우 빈 문자열이 반환됩니다.
연관된 텍스트 표현이 없는 오류가 발생한 경우에도 빈 문자열이 반환될 수 있습니다.
void reset() |
모델을 재설정합니다. 모든 검색 제안이 지워지고 미결 요청이 중단되며 가능한 오류가 지워집니다. 모델 상태는 PlaceSearchSuggestionModel.Null로 설정됩니다.
void update() |
제공된 쿼리 매개 변수를 기반으로 모델을 업데이트합니다. 모델에는 searchTerm 및 searchArea 부분 검색 제안 목록이 채워집니다. plugin 에서 지원하는 경우 limit 및 offset 와 같은 다른 매개 변수가 지정될 수 있습니다. update()
는 처리할 plugin 에 매개 변수 집합을 제출합니다.
모델이 업데이트되는 동안 모델의 status 은 PlaceSearchSuggestionModel.Loading
으로 설정됩니다. 모델이 성공적으로 업데이트되면 status 은 PlaceSearchSuggestionModel.Ready
으로 설정되고, 성공적으로 완료되지 않으면 status 은 PlaceSearchSuggestionModel.Error
으로 설정되고 모델이 지워집니다.
이 예는 모델 사용을 보여줍니다.
PlaceSeachSuggestionModel { id: model plugin: backendPlugin searchArea: QtPositioning.circle(QtPositioning.coordinate(10, 10)) ... } MouseArea { ... onClicked: { model.searchTerm = "piz" model.searchArea.center.latitude = -27.5; model.searchArea.cetner.longitude = 153; model.update(); } }
더 자세한 예는 장소(QML ) 예제에서 찾을 수 있습니다.
© 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.