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 클래스는 장소 정보를 포함하는 데이터 스토어를 추상화한 것입니다. 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) 작업이 끝나면 reply 객체를 삭제합니다.
searchReply->deleteLater();
searchReply = nullptr;
}QPlaceManager의 사용 방법을 보여주는 예제 목록은 ‘일반 작업’을 참조하십시오.
카테고리 초기화
애플리케이션 시작 과정에서 적절한 시점에 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 에 해당하는 장소를 제거합니다.
사용 예제는 ` Removing a place cpp `를 참조하십시오.
QPlaceIdReply *QPlaceManager::saveCategory(const QPlaceCategory &category, const QString &parentId = QString())
parentId 로 지정된 카테고리의 하위 카테고리인 ‘ category ’를 저장합니다. parentId 가 비어 있으면 ‘ category ’가 최상위 카테고리로 저장됩니다.
사용 예시는 ‘카테고리 저장하기’를 참조하십시오.
QPlaceIdReply *QPlaceManager::savePlace(const QPlace &place)
지정된 ‘ place ’를 저장합니다.
사용 예시는 Saving a place cpp를 참조하십시오.
QPlaceSearchReply *QPlaceManager::search(const QPlaceSearchRequest &request) const
request 에 지정된 매개변수에 따라 장소를 검색합니다.
사용 예시는 Discovery/Search를 참조하십시오.
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()도 참조하십시오 .
© 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.