Albert
Loading...
Searching...
No Matches
albert::QueryResults Class Reference

#include <albert/queryresults.h>

Description

Query results container.

Holds the results of a Query and emits signals as expected by the UI models.

Inheritance diagram for albert::QueryResults:
[legend]

Public Member Functions

 QueryResults (const QueryContext &context)
 Constructs query results with the context it belongs to.
 
 ~QueryResults () override
 Destructs the query results.
 
QueryResultoperator[] (size_t index)
 Returns the result at index index.
 
const QueryResultoperator[] (size_t index) const
 Returns the result at index index.
 
uint count () const
 Returns the number of results.
 
bool activate (uint item_index, uint action_index=0)
 Activates the action at action_index of the result item at item_index.
 
void add (const Extension &extension, ItemPtr auto &&item)
 Appends a QueryResult constructed from extension and item.
 
void add (ItemPtr auto &&item)
 Appends a QueryResult constructed from item and the handler this results belong to.
 
void add (std::ranges::range auto &&query_results)
 Appends query_results to the results.
 
void add (const Extension &extension, ItemRange auto &&items)
 Appends QueryResult's constructed from extension and items.
 
void add (ItemRange auto &&items)
 Appends QueryResult's constructed from items and the handler this results belong to.
 
void remove (uint index, uint count=1)
 Removes count results starting from index.
 
void reset ()
 Removes all results.
 

Signals

void resultsAboutToBeInserted (int first, int last)
 Emitted before results are inserted.
 
void resultsInserted ()
 Emitted after results have been inserted.
 
void resultsAboutToBeRemoved (int first, int last)
 Emitted before results are removed.
 
void resultsRemoved ()
 Emitted after results have been removed.
 
void resultsAboutToBeMoved (int srcFirst, int srcLast, int dst)
 Emitted before results are moved.
 
void resultsMoved ()
 Emitted after results have been moved.
 
void resultsAboutToBeReset ()
 Emitted before all results are reset.
 
void resultsReset ()
 Emitted after all results have been reset.
 
void resultChanged (uint i)
 Emitted when a result changed.
 
void resultActivated (QString query, QString extension_id, QString item_id, QString action_id)
 Emitted when a result was activated.
 

Member Function Documentation

◆ add() [1/2]

void albert::QueryResults::add ( const Extension extension,
ItemPtr auto &&  item 
)
inline

Appends a QueryResult constructed from extension and item.

Use the range add methods to avoid UI flicker.

◆ add() [2/2]

void albert::QueryResults::add ( ItemPtr auto &&  item)
inline

Appends a QueryResult constructed from item and the handler this results belong to.

Use the range add methods to avoid UI flicker.


The documentation for this class was generated from the following file: