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

#include <standarditem.h>

Inheritance diagram for albert::StandardItem:
albert::Item

Detailed Description

General purpose value type Item implememtation.

Public Member Functions

 StandardItem (QString id={}, QString text={}, QString subtext={}, QString input_action_text={}, QStringList icon_urls={}, std::vector< Action > actions={})
 StandardItem constructor. More...
 
 StandardItem (StandardItem &&)=default
 StandardItem move constructor. More...
 
StandardItemoperator= (StandardItem &&)=default
 StandardItem move assignment. More...
 
 StandardItem (const StandardItem &)=delete
 
StandardItemoperator= (const StandardItem &)=delete
 
void setId (QString id)
 Setter for the item identifier. More...
 
void setText (QString text)
 Setter for the item text. More...
 
void setSubtext (QString subtext)
 Setter for the item subtext. More...
 
void setInputActionText (QString input_action_text)
 Setter for the items iconUrls. More...
 
void setIconUrls (QStringList icon_urls)
 Setter for the input action text. More...
 
void setActions (std::vector< Action > actions)
 Setter for item actions. More...
 
QString id () const override
 Getter for the item identifier. More...
 
QString text () const override
 Getter for the item text. More...
 
QString subtext () const override
 Getter for the item subtext. More...
 
QString inputActionText () const override
 Getter for the input action text. More...
 
QStringList iconUrls () const override
 Getter for the items iconUrls. More...
 
std::vector< Actionactions () const override
 Getter for item actions. More...
 
- Public Member Functions inherited from albert::Item
virtual ~Item ()=default
 
virtual QString id () const =0
 Getter for the item identifier. More...
 
virtual QString text () const =0
 Getter for the item text. More...
 
virtual QString subtext () const =0
 Getter for the item subtext. More...
 
virtual QStringList iconUrls () const =0
 Getter for the items iconUrls. More...
 
virtual QString inputActionText () const
 Getter for the input action text. More...
 
virtual std::vector< Actionactions () const
 Getter for item actions. More...
 

Static Public Member Functions

static std::shared_ptr< StandardItemmake (QString id={}, QString text={}, QString subtext={}, QString input_action_text={}, QStringList icon_urls={}, std::vector< Action > actions={})
 Convenience shared pointer factory for standard items. More...
 
static std::shared_ptr< StandardItemmake (QString id={}, QString text={}, QString subtext={}, QStringList icon_urls={}, std::vector< Action > actions={})
 Convenience shared pointer factory for standard items w/o inputAction. More...
 

Protected Attributes

QString id_
 
QString text_
 
QString subtext_
 
QString input_action_text_
 
QStringList icon_urls_
 
std::vector< Actionactions_
 

Constructor & Destructor Documentation

◆ StandardItem() [1/3]

albert::StandardItem::StandardItem ( QString  id = {},
QString  text = {},
QString  subtext = {},
QString  input_action_text = {},
QStringList  icon_urls = {},
std::vector< Action actions = {} 
)
explicit

StandardItem constructor.

Parameters
idHas to be unique per extension.

This function is involved in several time critical operartion such as indexing and sorting. It is therefore recommended to return a string that is as short as possible as fast as possible.

Parameters
textPrimary text displayed emphasized in a list item.

This string is used in scoring. It is therefore recommended to return as fast as possible. The text length is used as divisor for scoring, hence the string must not be empty, otherwise you get undefined behavior. For performance reasons text length is not checked.

Parameters
subtextSecondary descriptive text displayed in a list item.
input_action_textUsed to get the item icon using the IconProvider.
icon_urlsUsed as input text replacement (usually by pressing Tab).
actionsThese are the actions a users can run.

◆ StandardItem() [2/3]

albert::StandardItem::StandardItem ( StandardItem &&  )
default

StandardItem move constructor.

◆ StandardItem() [3/3]

albert::StandardItem::StandardItem ( const StandardItem )
delete

Member Function Documentation

◆ actions()

std::vector< Action > albert::StandardItem::actions ( ) const
overridevirtual

Getter for item actions.

These are the actions a users can run.

Reimplemented from albert::Item.

◆ iconUrls()

QStringList albert::StandardItem::iconUrls ( ) const
overridevirtual

Getter for the items iconUrls.

Used to get the item icon using the IconProvider.

Implements albert::Item.

◆ id()

QString albert::StandardItem::id ( ) const
overridevirtual

Getter for the item identifier.

Has to be unique per extension.

This function is involved in several time critical operartion such as indexing and sorting. It is therefore recommended to return a string that is as short as possible as fast as possible.

Implements albert::Item.

◆ inputActionText()

QString albert::StandardItem::inputActionText ( ) const
overridevirtual

Getter for the input action text.

Used as input text replacement (usually by pressing Tab).

Reimplemented from albert::Item.

◆ make() [1/2]

static std::shared_ptr< StandardItem > albert::StandardItem::make ( QString  id = {},
QString  text = {},
QString  subtext = {},
QString  input_action_text = {},
QStringList  icon_urls = {},
std::vector< Action actions = {} 
)
static

Convenience shared pointer factory for standard items.

◆ make() [2/2]

static std::shared_ptr< StandardItem > albert::StandardItem::make ( QString  id = {},
QString  text = {},
QString  subtext = {},
QStringList  icon_urls = {},
std::vector< Action actions = {} 
)
static

Convenience shared pointer factory for standard items w/o inputAction.

◆ operator=() [1/2]

StandardItem & albert::StandardItem::operator= ( const StandardItem )
delete

◆ operator=() [2/2]

StandardItem & albert::StandardItem::operator= ( StandardItem &&  )
default

StandardItem move assignment.

◆ setActions()

void albert::StandardItem::setActions ( std::vector< Action actions)

Setter for item actions.

These are the actions a users can run.

◆ setIconUrls()

void albert::StandardItem::setIconUrls ( QStringList  icon_urls)

Setter for the input action text.

Used as input text replacement (usually by pressing Tab).

◆ setId()

void albert::StandardItem::setId ( QString  id)

Setter for the item identifier.

Has to be unique per extension.

This function is involved in several time critical operartion such as indexing and sorting. It is therefore recommended to return a string that is as short as possible as fast as possible.

◆ setInputActionText()

void albert::StandardItem::setInputActionText ( QString  input_action_text)

Setter for the items iconUrls.

Used to get the item icon using the IconProvider.

◆ setSubtext()

void albert::StandardItem::setSubtext ( QString  subtext)

Setter for the item subtext.

Secondary descriptive text displayed in a list item.

◆ setText()

void albert::StandardItem::setText ( QString  text)

Setter for the item text.

Primary text displayed emphasized in a list item.

This string is used in scoring. It is therefore recommended to return as fast as possible. The text length is used as divisor for scoring, hence the string must not be empty, otherwise you get undefined behavior. For performance reasons text length is not checked.

◆ subtext()

QString albert::StandardItem::subtext ( ) const
overridevirtual

Getter for the item subtext.

Secondary descriptive text displayed in a list item.

Implements albert::Item.

◆ text()

QString albert::StandardItem::text ( ) const
overridevirtual

Getter for the item text.

Primary text displayed emphasized in a list item.

This string is used in scoring. It is therefore recommended to return as fast as possible. The text length is used as divisor for scoring, hence the string must not be empty, otherwise you get undefined behavior. For performance reasons text length is not checked.

Implements albert::Item.

Member Data Documentation

◆ actions_

std::vector<Action> albert::StandardItem::actions_
protected

◆ icon_urls_

QStringList albert::StandardItem::icon_urls_
protected

◆ id_

QString albert::StandardItem::id_
protected

◆ input_action_text_

QString albert::StandardItem::input_action_text_
protected

◆ subtext_

QString albert::StandardItem::subtext_
protected

◆ text_

QString albert::StandardItem::text_
protected

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