QPlaceManager Class
QPlaceManager 클래스는 클라이언트가 특정 백엔드에 저장된 장소에 액세스할 수 있는 인터페이스를 제공합니다. 더 보기...
Header: | #include <QPlaceManager> |
qmake: | QT += location |
Inherits: | QObject |
공용 함수
virtual | ~QPlaceManager() |
QPlaceCategory | category(const QString &categoryId) const |
QList<QPlaceCategory> | childCategories(const QString &parentId = QString()) const |
QStringList | childCategoryIds(const QString &parentId = QString()) const |
QPlace | compatiblePlace(const QPlace &original) const |
QPlaceContentReply * | getPlaceContent(const QPlaceContentRequest &request) const |
QPlaceDetailsReply * | getPlaceDetails(const QString &placeId) const |
QPlaceReply * | initializeCategories() |
QList<QLocale> | locales() const |
QString | managerName() const |
int | managerVersion() const |
QPlaceMatchReply * | matchingPlaces(const QPlaceMatchRequest &request) const |
QString | parentCategoryId(const QString &categoryId) const |
QPlaceIdReply * | removeCategory(const QString &categoryId) |
QPlaceIdReply * | removePlace(const QString &placeId) |
QPlaceIdReply * | saveCategory(const QPlaceCategory &category, const QString &parentId = QString()) |
QPlaceIdReply * | savePlace(const QPlace &place) |
QPlaceSearchReply * | search(const QPlaceSearchRequest &request) const |
QPlaceSearchSuggestionReply * | searchSuggestions(const QPlaceSearchRequest &request) const |
void | setLocale(const QLocale &locale) |
void | setLocales(const QList<QLocale> &locales) |
신호
void | categoryAdded(const QPlaceCategory &category, const QString &parentId) |
void | categoryRemoved(const QString &categoryId, const QString &parentId) |
void | categoryUpdated(const QPlaceCategory &category, const QString &parentId) |
void | dataChanged() |
void | errorOccurred(QPlaceReply *reply, QPlaceReply::Error error, const QString &errorString = QString()) |
void | finished(QPlaceReply *reply) |
void | placeAdded(const QString &placeId) |
void | placeRemoved(const QString &placeId) |
void | placeUpdated(const QString &placeId) |
상세 설명
다음 표는 QPlaceManager에서 제공하는 기능에 대한 개요를 제공합니다.
기능 | 설명 |
---|---|
장소 검색 | 검색어 및 검색 영역과 같은 매개변수 집합을 사용하여 사용자에게 관련 장소를 반환할 수 있습니다. |
카테고리 | 장소는 다양한 카테고리에 속하는 것으로 분류할 수 있습니다. 관리자는 이러한 카테고리에 대한 액세스를 지원합니다. |
검색어 제안 | 부분적으로 완전한 검색어가 주어지면 잠재적인 검색어 목록이 제공될 수 있습니다. |
추천 | 기존 장소가 주어지면 유사한 추천 장소 세트를 사용자에게 제안할 수 있습니다. |
풍부한 콘텐츠 | 이미지, 리뷰 등과 같은 풍부한 콘텐츠를 페이지 방식으로 검색할 수 있습니다. |
장소 또는 카테고리 관리 | 장소와 카테고리를 저장하고 삭제할 수 있습니다. 이 경우 알림을 받을 수 있습니다. |
현지화 | 장소 데이터를 다른 언어로 반환하도록 다른 로캘을 지정할 수 있습니다. |
QPlaceManager 인스턴스 가져오기
관리자를 만드는 방법은 QGeoServiceProvider 에서 관리자 초기화하기를 참조하세요.
비동기 인터페이스
QPlaceManager 클래스는 장소 정보를 포함하는 데이터스토어의 추상화를 제공합니다. QPlaceManager가 제공하는 함수는 주로 비동기식이며 요청-응답 모델을 따릅니다. 일반적으로 다양한 매개변수 집합으로 구성된 요청이 매니저에게 전달되고 응답 객체가 생성됩니다. 응답 객체에는 요청이 완료되면 이를 알리는 신호가 있으며, 요청이 완료되면 응답에는 요청 결과와 함께 발생한 오류(있는 경우)가 포함됩니다.
비동기 요청은 일반적으로 다음과 같이 처리됩니다:
//1) 적절한 요청을 합니다.QPlaceSearchRequest searchRequest; searchRequest.setSearchTerm("ice cream"); searchRequest.setSearchArea(QGeoCircle(QGeoCoordinate(12.34, 56.78)));//2) 매니저를 사용하여 요청을 시작하고 응답 객체를 검색합니다.QPlaceSearchReply * searchReply = manager->search(searchRequest);//3) 작업 완료 시 호출되는 슬롯에 응답 객체를연결 connect(searchReply, &.QPlaceSearchReply::finished, this, &RequestHandler::processSearchReply); ... ...//4) 슬롯이 연산 결과를 적절히 처리하게함 void processSearchReply() { if (searchReply->error()==... QPlaceReply::NoError) { for(const QPlaceSearchResult &result: searchReply->results()) { if (result.type()==. QPlaceSearchResult::PlaceResult) qDebug() << "Title:" << result.title(); } }//5) 완료되면 의존 객체를 삭제합니다. searchReply->deleteLater(); searchReply = nullptr; }
QPlaceManger가 어떻게 사용되는지 보여주는 예제 목록은 일반적인 작업을 참조하세요.
카테고리 초기화
애플리케이션을 시작하는 동안 가끔 initializeCategories() 함수를 호출하여 카테고리를 설정해야 합니다. 카테고리를 초기화하면 다음 함수를 사용할 수 있습니다:
- QPlaceManager::childCategories()
- QPlaceManager::category()
- QPlaceManager::parentCategoryId()
- QPlaceManager::childCategoryIds();
카테고리를 새로 고치거나 다시 로드해야 하는 경우 initializeCategories() 함수를 다시 호출할 수 있습니다.
멤버 함수 문서
[virtual noexcept]
QPlaceManager::~QPlaceManager()
관리자를 소멸시킵니다. 이 소멸자는 QGeoServiceProvider 에서 내부적으로 사용되며 애플리케이션 코드에서 호출할 필요가 없습니다.
QPlaceCategory QPlaceManager::category(const QString &categoryId) const
주어진 categoryId 에 해당하는 카테고리를 반환합니다.
[signal]
void QPlaceManager::categoryAdded(const QPlaceCategory &category, const QString &parentId)
이 신호는 관리자의 데이터스토어에 category 가 추가된 경우에 발생합니다. category 의 부모는 parentId 으로 지정됩니다.
이 신호는 QPlaceManager::NotificationsFeature를 지원하는 관리자에 의해서만 발생됩니다.
dataChanged()도 참조하세요 .
[signal]
void QPlaceManager::categoryRemoved(const QString &categoryId, const QString &parentId)
이 신호는 categoryId 에 해당하는 카테고리가 관리자의 데이터스토어에서 제거되었을 때 발생합니다. 제거된 카테고리의 부모는 parentId 에 의해 지정됩니다.
이 신호는 QPlaceManager::NotificationsFeature를 지원하는 관리자에 의해서만 발생됩니다.
dataChanged()도 참조하세요 .
[signal]
void QPlaceManager::categoryUpdated(const QPlaceCategory &category, const QString &parentId)
이 신호는 관리자의 데이터스토어에서 category 가 수정된 경우에 발생합니다. 수정된 카테고리의 부모는 parentId 로 지정됩니다.
이 신호는 QPlaceManager::NotificationsFeature를 지원하는 관리자만 발신합니다.
dataChanged()도 참조하세요 .
QList<QPlaceCategory> QPlaceManager::childCategories(const QString &parentId = QString()) const
parentId 에 해당하는 카테고리의 하위 카테고리 목록을 반환합니다. parentId 이 비어 있으면 최상위 카테고리가 모두 반환됩니다.
QStringList QPlaceManager::childCategoryIds(const QString &parentId = QString()) const
parentId 에 해당하는 카테고리의 하위 카테고리 식별자를 반환합니다. parentId 이 비어 있으면 모든 최상위 카테고리 식별자가 반환됩니다.
QPlace QPlaceManager::compatiblePlace(const QPlace &original) const
이 관리자에 저장하기에 적합한 original 장소의 잘린 버전 또는 수정된 버전을 반환합니다.
수정된 버전에는 이 매니저가 지원하는 장소 세부 정보만 있습니다. 장소 ID와 같은 관리자 특정 데이터는 original 에서 복사되지 않습니다.
[signal]
void QPlaceManager::dataChanged()
이 신호는 기본 데이터스토어에 대규모 변경이 있고 관리자가 클라이언트가 모든 데이터를 다시 로드해야 할 만큼 급진적인 변경이라고 판단하는 경우 관리자가 발신합니다.
이 신호가 발생하면 관련 변경 사항에 대한 다른 신호는 발생하지 않습니다.
이 신호는 QPlaceManager::NotificationsFeature를 지원하는 관리자에 의해서만 방출됩니다.
[signal]
void QPlaceManager::errorOccurred(QPlaceReply *reply, QPlaceReply::Error error, const QString &errorString = QString())
이 신호는 reply 처리 중 오류가 감지되었을 때 발생합니다. QPlaceManager::finished() 신호가 뒤따를 수 있습니다.
오류는 오류 코드 error 로 설명됩니다. errorString 이 비어 있지 않으면 최종 사용자가 아닌 개발자를 위한 오류에 대한 텍스트 설명이 포함됩니다.
이 신호와 QPlaceReply::errorOccurred() 신호가 동시에 전송됩니다.
참고: 이 신호에 연결된 슬롯의 reply 객체를 삭제하지 마세요. 대신 deleteLater()를 사용하세요.
[signal]
void QPlaceManager::finished(QPlaceReply *reply)
이 신호는 reply 처리가 완료되면 전송됩니다.
reply->error()가 QPlaceReply::NoError 와 같으면 처리가 성공적으로 완료된 것입니다.
이 신호와 QPlaceReply::finished()가 동시에 전송됩니다.
참고: 이 신호에 연결된 슬롯의 reply 객체를 삭제하지 마세요. 대신 deleteLater()를 사용하세요.
QPlaceContentReply *QPlaceManager::getPlaceContent(const QPlaceContentRequest &request) const
request 에 지정된 매개 변수에 따라 장소의 콘텐츠를 검색합니다.
사용 예는 리치 콘텐츠 가져오기를 참조하세요.
QPlaceDetailsReply *QPlaceManager::getPlaceDetails(const QString &placeId) const
주어진 placeId 에 해당하는 장소의 상세 정보를 검색합니다.
사용 예는 장소 세부 정보 가져오기를 참조하세요.
QPlaceReply *QPlaceManager::initializeCategories()
관리자의 카테고리를 초기화합니다.
사용 예는 카테고리 사용을 참조하세요.
QList<QLocale> QPlaceManager::locales() const
기본 설정 로캘 목록을 반환합니다. 로캘은 관리자에게 어떤 언어 장소와 카테고리 세부 정보를 반환해야 하는지에 대한 힌트로 사용됩니다.
처음 지정된 로캘을 수용할 수 없는 경우 관리자는 다음 로캘로 넘어가는 식으로 돌아가게 됩니다. 일부 관리자 백엔드는 엄격하게 정의된 로캘 집합을 지원하지 않을 수 있습니다. 임의의 예로 프랑스의 일부 지역에서는 프랑스어와 영어 로컬라이제이션이 모두 지원되는 반면 미국의 특정 지역에서는 영어 로컬라이제이션만 지원될 수 있다는 점을 들 수 있습니다. 이 예에서 지원되는 로캘 세트는 검색 위치에 따라 상황에 따라 달라집니다.
관리자가 선호하는 로캘을 수용할 수 없는 경우 관리자는 백엔드별로 지원되는 언어를 사용하게 됩니다.
로캘에 대한 지원은 제공업체마다 다를 수 있습니다. 로캘을 지원하는 제공업체의 경우 기본적으로 글로벌 기본 로캘이 관리자의 유일한 로캘로 설정됩니다.
로캘을 지원하지 않는 관리자의 경우 로캘 목록은 항상 비어 있습니다.
setLocales()도 참조하세요 .
QString QPlaceManager::managerName() const
관리자의 이름을 반환합니다.
int QPlaceManager::managerVersion() const
관리자 버전을 반환합니다.
QPlaceMatchReply *QPlaceManager::matchingPlaces(const QPlaceMatchRequest &request) const
request 에 지정된 장소와 일치하거나 일치하는 장소 목록이 포함된 응답을 반환합니다. 요청에 지정된 장소는 다른 관리자로부터 온 것입니다.
QString QPlaceManager::parentCategoryId(const QString &categoryId) const
categoryId 에 해당하는 카테고리의 상위 카테고리 식별자를 반환합니다.
[signal]
void QPlaceManager::placeAdded(const QString &placeId)
이 신호는 매니저 엔진의 데이터스토어에 장소가 추가된 경우 발생합니다. 추가된 특정 장소는 placeId 에 의해 지정됩니다.
이 신호는 QPlaceManager::NotificationsFeature를 지원하는 관리자에서만 발생합니다.
dataChanged()도 참조하세요 .
[signal]
void QPlaceManager::placeRemoved(const QString &placeId)
이 신호는 관리자의 데이터스토어에서 장소가 제거된 경우 발생합니다. 제거된 특정 장소는 placeId 에 의해 지정됩니다.
이 신호는 QPlaceManager::NotificationsFeature를 지원하는 관리자에 의해서만 발생됩니다.
dataChanged()도 참조하세요 .
[signal]
void QPlaceManager::placeUpdated(const QString &placeId)
이 신호는 관리자의 데이터스토어에서 장소가 수정된 경우 발생합니다. 수정된 특정 장소는 placeId 에 의해 지정됩니다.
이 신호는 QPlaceManager::NotificationsFeature를 지원하는 관리자에 의해서만 발생됩니다.
dataChanged()도 참조하세요 .
QPlaceIdReply *QPlaceManager::removeCategory(const QString &categoryId)
관리자에서 categoryId 에 해당하는 카테고리를 제거합니다.
사용 예는 카테고리 제거하기를 참조하세요.
QPlaceIdReply *QPlaceManager::removePlace(const QString &placeId)
관리자에서 placeId 에 해당하는 장소를 제거합니다.
사용 예는 장소 cpp 제거하기를 참조하세요.
QPlaceIdReply *QPlaceManager::saveCategory(const QPlaceCategory &category, const QString &parentId = QString())
parentId 으로 지정된 카테고리의 하위 카테고리인 category 을 저장합니다. 비어 있는 parentId 은 category 이 최상위 카테고리로 저장됨을 의미합니다.
사용 예는 카테고리 저장하기를 참조하세요.
QPlaceIdReply *QPlaceManager::savePlace(const QPlace &place)
지정된 place 을 저장합니다.
사용 예는 장소 cpp 저장하기를 참조하세요.
QPlaceSearchReply *QPlaceManager::search(const QPlaceSearchRequest &request) const
request 에 지정된 매개변수에 따라 장소를 검색합니다.
사용 예는 검색/검색을 참조하세요.
QPlaceSearchSuggestionReply *QPlaceManager::searchSuggestions(const QPlaceSearchRequest &request) const
request 에 지정된 매개변수에 따라 일련의 검색어 제안을 요청합니다. request 에는 불완전한 검색어와 함께 관련 검색 결과의 범위를 좁히기 위한 검색 영역 등의 기타 데이터가 저장될 수 있습니다.
사용 예는 검색 제안을 참조하세요.
void QPlaceManager::setLocale(const QLocale &locale)
관리자가 선호하는 로캘 목록을 하나의 locale 로 설정하는 편의 기능입니다.
void QPlaceManager::setLocales(const QList<QLocale> &locales)
기본 설정 목록 설정 locales.
locales()도 참조하세요 .
© 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.