Albert
|
#include <albert/standarditem.h>
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 | |
StandardItem & | operator= (const StandardItem &)=delete |
StandardItem (StandardItem &&other) noexcept=default | |
Constructs a StandardItem with the contents of other using move semantics. | |
StandardItem & | operator= (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< Action > | actions () const override |
Getter for item actions. | |
![]() | |
virtual | ~Item () |
Static Public Member Functions | |
static std::shared_ptr< StandardItem > | make (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< StandardItem > | make (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< Action > | actions_ |
|
explicitnoexcept |
Constructs a StandardItem with the contents initialized with the data passed.
id | Getter for the item identifier. |
text | Getter for the item text. |
subtext | Getter for the item subtext. |
input_action_text | Getter for the input action text. |
icon_urls | Getter for the items iconUrls. |
actions | Getter for item actions. |
|
delete |
|
defaultnoexcept |
Constructs a StandardItem with the contents of other
using move semantics.
|
overridevirtual |
|
overridevirtual |
Getter for the items iconUrls.
Used to get the item icon using the IconProvider.
Implements albert::Item.
|
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.
|
overridevirtual |
Getter for the input action text.
Used as input text replacement (usually by pressing Tab).
Reimplemented from albert::Item.
|
static |
Convenience shared pointer factory for standard items.
|
static |
Convenience shared pointer factory for standard items w/o inputAction.
|
delete |
|
defaultnoexcept |
Replaces the contents with those of other
using move semantics.
void albert::StandardItem::setActions | ( | std::vector< Action > | actions | ) |
Sets the item actions to actions
.
void albert::StandardItem::setIconUrls | ( | QStringList | urls | ) |
Sets the item icon urls to urls
.
void albert::StandardItem::setId | ( | QString | id | ) |
Sets the item identifier to id
.
void albert::StandardItem::setInputActionText | ( | QString | text | ) |
Sets the item input action text to text
.
void albert::StandardItem::setSubtext | ( | QString | text | ) |
Sets the item subtext to text
.
void albert::StandardItem::setText | ( | QString | text | ) |
Sets the item text to text
.
|
overridevirtual |
Getter for the item subtext.
Secondary descriptive text displayed in a list item.
Implements albert::Item.
|
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.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |