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.
 

Constructor & Destructor Documentation

◆ QueryResults()

albert::QueryResults::QueryResults ( const QueryContext context)

Constructs query results with the context it belongs to.

◆ ~QueryResults()

albert::QueryResults::~QueryResults ( )
override

Destructs the query results.

Member Function Documentation

◆ activate()

bool albert::QueryResults::activate ( uint  item_index,
uint  action_index = 0 
)

Activates the action at action_index of the result item at item_index.

◆ add() [1/5]

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/5]

void albert::QueryResults::add ( const Extension extension,
ItemRange auto &&  items 
)
inline

Appends QueryResult's constructed from extension and items.

◆ add() [3/5]

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.

◆ add() [4/5]

void albert::QueryResults::add ( ItemRange auto &&  items)
inline

Appends QueryResult's constructed from items and the handler this results belong to.

◆ add() [5/5]

void albert::QueryResults::add ( std::ranges::range auto &&  query_results)
inline

Appends query_results to the results.

◆ count()

uint albert::QueryResults::count ( ) const
inline

Returns the number of results.

◆ operator[]() [1/2]

QueryResult & albert::QueryResults::operator[] ( size_t  index)
inline

Returns the result at index index.

◆ operator[]() [2/2]

const QueryResult & albert::QueryResults::operator[] ( size_t  index) const
inline

Returns the result at index index.

◆ remove()

void albert::QueryResults::remove ( uint  index,
uint  count = 1 
)
inline

Removes count results starting from index.

◆ reset()

void albert::QueryResults::reset ( )
inline

Removes all results.

◆ resultActivated

void albert::QueryResults::resultActivated ( QString  query,
QString  extension_id,
QString  item_id,
QString  action_id 
)
signal

Emitted when a result was activated.

◆ resultChanged

void albert::QueryResults::resultChanged ( uint  i)
signal

Emitted when a result changed.

◆ resultsAboutToBeInserted

void albert::QueryResults::resultsAboutToBeInserted ( int  first,
int  last 
)
signal

Emitted before results are inserted.

◆ resultsAboutToBeMoved

void albert::QueryResults::resultsAboutToBeMoved ( int  srcFirst,
int  srcLast,
int  dst 
)
signal

Emitted before results are moved.

◆ resultsAboutToBeRemoved

void albert::QueryResults::resultsAboutToBeRemoved ( int  first,
int  last 
)
signal

Emitted before results are removed.

◆ resultsAboutToBeReset

void albert::QueryResults::resultsAboutToBeReset ( )
signal

Emitted before all results are reset.

◆ resultsInserted

void albert::QueryResults::resultsInserted ( )
signal

Emitted after results have been inserted.

◆ resultsMoved

void albert::QueryResults::resultsMoved ( )
signal

Emitted after results have been moved.

◆ resultsRemoved

void albert::QueryResults::resultsRemoved ( )
signal

Emitted after results have been removed.

◆ resultsReset

void albert::QueryResults::resultsReset ( )
signal

Emitted after all results have been reset.


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