QPlaceContentRequest Class
QPlaceContentRequest 类表示内容请求的参数。更多
Header: | #include <QPlaceContentRequest> |
qmake: | QT += location |
公共函数
QPlaceContentRequest() | |
QPlaceContentRequest(const QPlaceContentRequest &other) | |
~QPlaceContentRequest() | |
void | clear() |
QVariant | contentContext() const |
QPlaceContent::Type | contentType() const |
int | limit() const |
QString | placeId() const |
void | setContentContext(const QVariant &context) |
void | setContentType(QPlaceContent::Type type) |
void | setLimit(int limit) |
void | setPlaceId(const QString &identifier) |
QPlaceContentRequest & | operator=(const QPlaceContentRequest &other) |
相关非成员
bool | operator!=(const QPlaceContentRequest &lhs, const QPlaceContentRequest &rhs) |
bool | operator==(const QPlaceContentRequest &lhs, const QPlaceContentRequest &rhs) |
详细说明
QPlaceContentRequest 类与QPlaceManager 结合使用,以分页方式检索图片和评论等丰富内容。下面的代码将从第10个索引中请求一组5张图片:
QPlaceContentRequest request; request.setContentType(QPlaceContent::ImageType); request.setPlaceId(place.placeId()); request.setLimit(5); QPlaceContentReply *contentReply = manager->getPlaceContent(request); //..connect signals..// ... ... void contentHandler() { if (contentReply->error() == QPlaceReply::NoError) { place.insertContent(contentReply->request().contentType(), contentReply->content()); } }
另请参见 QPlaceContentReply 。
成员函数文档
QPlaceContentRequest::QPlaceContentRequest()
构造一个新的请求对象。
[noexcept]
QPlaceContentRequest::QPlaceContentRequest(const QPlaceContentRequest &other)
构造other 的副本。
[noexcept]
QPlaceContentRequest::~QPlaceContentRequest()
销毁请求对象
void QPlaceContentRequest::clear()
清除内容请求。
QVariant QPlaceContentRequest::contentContext() const
返回与该地点内容请求相关的后台特定附加内容上下文。
另请参阅 setContentContext()。
QPlaceContent::Type QPlaceContentRequest::contentType() const
返回要请求的内容类型,例如评论或图片
另请参阅 setContentType()。
int QPlaceContentRequest::limit() const
返回要检索的内容项的最大数量。
limit 的负值表示未定义。这将由后端提供商选择合适的返回条数。
默认限制为-1。
另请参阅 setLimit()。
QString QPlaceContentRequest::placeId() const
返回要获取内容的位置标识符。
另请参阅 setPlaceId()。
void QPlaceContentRequest::setContentContext(const QVariant &context)
将内容上下文设置为context 。
注: 此方法供地理服务插件在返回地点内容结果时使用。
后端使用内容上下文来存储与内容请求相关的附加内容上下文。其他相关字段也应填写。例如,如果内容请求是图像内容,则还应使用setContentType() 设置内容类型。内容上下文允许保存无法通过Qt Location API 直接访问的附加上下文。
内容上下文可以是可存储在QVariant 中的任何类型。应用程序不能直接使用内容上下文的值。
另请参阅 contentContext() 。
void QPlaceContentRequest::setContentType(QPlaceContent::Type type)
设置所请求内容的type 。
另请参阅 contentType().
void QPlaceContentRequest::setLimit(int limit)
将检索内容项的最大数量设为limit 。
另请参阅 limit() 。
void QPlaceContentRequest::setPlaceId(const QString &identifier)
将要获取内容的位置标识符设置为identifier 。
另请参阅 placeId() 。
[noexcept]
QPlaceContentRequest &QPlaceContentRequest::operator=(const QPlaceContentRequest &other)
为该内容请求分配other 并返回对该内容请求的引用。
相关非会员
[noexcept]
bool operator!=(const QPlaceContentRequest &lhs, const QPlaceContentRequest &rhs)
如果lhs 不等于rhs ,则返回 true,否则返回 false。
[noexcept]
bool operator==(const QPlaceContentRequest &lhs, const QPlaceContentRequest &rhs)
如果lhs 等于rhs ,则返回 true,否则返回 false。
© 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.