Allows the results of a search query to be sent to the query source.
More...
#include <unity/scopes/qt/QSearchReply.h>
Allows the results of a search query to be sent to the query source.
void QSearchReply::error |
( |
std::exception_ptr |
ex | ) |
|
|
virtual |
Informs the source of a query that the query was terminated due to an error.
Multiple calls to error() and calls to finished() after error() was called are ignored.
- Parameters
-
ex | An exception_ptr indicating the cause of the error. If ex is a std::exception , the return value of what() is made available to the query source. Otherwise, the query source receives "unknown exception" . |
Sends a single result to the source of a query.
Any calls to push() after finished() was called are ignored.
- Returns
- The return value is true if the result was accepted, false otherwise. A false return value can be due to finished() having been called earlier, or the client that sent the query having cancelled that query. The return value is false also if the query has a cardinality limit and is reached or exceeded. (The return value is false for the last valid push and subsequent pushes.)
Register new category and send it to the source of the query.
- Parameters
-
id | The identifier of the category |
title | The title of the category |
icon | The icon of the category |
renderer_template | The renderer template to be used for results in this category |
- Returns
- The category instance
- Exceptions
-
unity::scopes::InvalidArgumentException | if category with that id has already been registered. |
void QSearchReply::register_departments |
( |
QDepartment::SCPtr const & |
parent | ) |
|
|
virtual |
Register departments for the current search reply and provide the current department.
Departments are optional. If scope supports departments, it is expected to register departments on every search as follows:
For example, assuming the user is visiting a "History" department in "Books", and "History" has sub-departments such as "World War Two" and "Ancient", the code that registers departments for current search in "History" may look like this:
parent of "History"
"History"));
Two")),
"Ancient"))});
history->set_subdepartments(history_depts);
books->set_subdepartments({history});
reply->register_departments(books);
Current department should be the department returned by unity::scopes::CannedQuery::department_id(). Empty department id denotes the root deparment.
- Parameters
-
parent | The parent department of current department, or current one if visiting root department. |
- Exceptions
-
unity::LogicException | if departments are invalid (nullptr passed, current department not present in the parent's tree, duplicated department ids present in the tree). |
The documentation for this class was generated from the following files: