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

#include <albert/standarditem.h>

Inheritance diagram for albert::StandardItem:
[legend]
Collaboration diagram for albert::StandardItem:
[legend]

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={}) noexcept
 Constructs a StandardItem with the contents initialized with the data passed.
 
 StandardItem (const StandardItem &)=delete
 
StandardItemoperator= (const StandardItem &)=delete
 
 StandardItem (StandardItem &&other) noexcept=default
 Constructs a StandardItem with the contents of other using move semantics.
 
StandardItemoperator= (StandardItem &&other) noexcept=default
 Replaces the contents with those of other using move semantics.
 
void setId (QString id)
 Sets the item identifier to id.
 
void setText (QString text)
 Sets the item text to text.
 
void setSubtext (QString text)
 Sets the item subtext to text.
 
void setInputActionText (QString text)
 Sets the item input action text to text.
 
void setIconUrls (QStringList urls)
 Sets the item icon urls to urls.
 
void setActions (std::vector< Action > actions)
 Sets the item actions to actions.
 
QString id () const override
 Getter for the item identifier.
 
QString text () const override
 Getter for the item text.
 
QString subtext () const override
 Getter for the item subtext.
 
QString inputActionText () const override
 Getter for the input action text.
 
QStringList iconUrls () const override
 Getter for the items iconUrls.
 
std::vector< Actionactions () const override
 Getter for item actions.
 
- Public Member Functions inherited from albert::Item
virtual ~Item ()
 

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.
 
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.
 

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 = {} 
)
explicitnoexcept

Constructs a StandardItem with the contents initialized with the data passed.

Parameters
idGetter for the item identifier.
textGetter for the item text.
subtextGetter for the item subtext.
input_action_textGetter for the input action text.
icon_urlsGetter for the items iconUrls.
actionsGetter for item actions.

◆ StandardItem() [2/3]

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

◆ StandardItem() [3/3]

albert::StandardItem::StandardItem ( StandardItem &&  other)
defaultnoexcept

Constructs a StandardItem with the contents of other using move semantics.

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 &&  other)
defaultnoexcept

Replaces the contents with those of other using move semantics.

◆ setActions()

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

Sets the item actions to actions.

◆ setIconUrls()

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

Sets the item icon urls to urls.

◆ setId()

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

Sets the item identifier to id.

◆ setInputActionText()

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

Sets the item input action text to text.

◆ setSubtext()

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

Sets the item subtext to text.

◆ setText()

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

Sets the item text to text.

◆ 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: