Albert
|
#include <albert/standarditem.h>
General purpose Item implementation.
Public Member Functions | |
template<typename T1 = QString, typename T2 = QString, typename T3 = QString, typename T4 = QStringList, typename T5 = std::vector<Action>, typename T6 = QString> requires (std::same_as<std::remove_cvref_t<T1>, QString> && std::same_as<std::remove_cvref_t<T2>, QString> && std::same_as<std::remove_cvref_t<T3>, QString> && std::same_as<std::remove_cvref_t<T4>, QStringList> && std::same_as<std::remove_cvref_t<T5>, std::vector<Action>> && std::same_as<std::remove_cvref_t<T6>, QString>) | |
StandardItem (T1 &&id, T2 &&text, T3 &&subtext, T4 &&icon_urls, T5 &&actions=std::vector< Action >{}, T6 &&input_action_text=QString{}) 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 | setIconUrls (QStringList urls) |
Sets the item icon urls to urls. | |
void | setActions (std::vector< Action > actions) |
Sets the item actions to actions. | |
void | setInputActionText (QString text) |
Sets the item input action text to text. | |
QString | id () const override |
Returns the item identifier. | |
QString | text () const override |
Returns the item text. | |
QString | subtext () const override |
Returns the item subtext. | |
QString | inputActionText () const override |
Returns the input action text. | |
QStringList | iconUrls () const override |
Returns the items icon urls. | |
std::vector< Action > | actions () const override |
Returns the item actions. | |
![]() | |
virtual | ~Item () |
virtual void | addObserver (Observer *observer) |
Start notifying observer about any changes. | |
virtual void | removeObserver (Observer *observer) |
Stop notifying observer about any changes. | |
Static Public Member Functions | |
template<typename T1 = QString, typename T2 = QString, typename T3 = QString, typename T4 = QStringList, typename T5 = std::vector<Action>, typename T6 = QString> requires (std::same_as<std::decay_t<T1>, QString> && std::same_as<std::decay_t<T2>, QString> && std::same_as<std::decay_t<T3>, QString> && std::same_as<std::decay_t<T4>, QStringList> && std::same_as<std::decay_t<T5>, std::vector<Action>> && std::same_as<std::decay_t<T6>, QString>) | |
static std::shared_ptr< StandardItem > | make (T1 &&id, T2 &&text, T3 &&subtext, T4 &&icon_urls, T5 &&actions=std::vector< Action >{}, T6 &&input_action_text=QString{}) noexcept |
Constructs a shared_ptr holding a StandardItem with the contents initialized with the data passed. | |
Protected Attributes | |
QString | id_ |
QString | text_ |
QString | subtext_ |
QStringList | icon_urls_ |
std::vector< Action > | actions_ |
QString | input_action_text_ |
|
inlinenoexcept |
Constructs a StandardItem with the contents initialized with the data passed.
|
delete |
|
defaultnoexcept |
Constructs a StandardItem with the contents of other using move semantics.
|
overridevirtual |
Returns the item actions.
These are the actions a users can run. The base implementation returns an empty vector.
Reimplemented from albert::Item.
|
overridevirtual |
Returns the items icon urls.
Used to get the item icon using the icon provider functions.
Implements albert::Item.
|
overridevirtual |
Returns 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 |
Returns the input action text.
Used as input text replacement (usually by pressing Tab). The base implementation returns text().
Reimplemented from albert::Item.
|
inlinestaticnoexcept |
Constructs a shared_ptr
holding a StandardItem with the contents initialized with the data passed.
Convenience function for readability. See the StandardItem::StandardItem for details.
|
delete |
|
defaultnoexcept |
Replaces the contents with those of other using move semantics.
void albert::util::StandardItem::setActions | ( | std::vector< Action > | actions | ) |
Sets the item actions to actions.
void albert::util::StandardItem::setIconUrls | ( | QStringList | urls | ) |
Sets the item icon urls to urls.
void albert::util::StandardItem::setId | ( | QString | id | ) |
Sets the item identifier to id.
void albert::util::StandardItem::setInputActionText | ( | QString | text | ) |
Sets the item input action text to text.
void albert::util::StandardItem::setSubtext | ( | QString | text | ) |
Sets the item subtext to text.
void albert::util::StandardItem::setText | ( | QString | text | ) |
Sets the item text to text.
|
overridevirtual |
Returns the item subtext.
Secondary descriptive text displayed in a list item.
Implements albert::Item.
|
overridevirtual |
Returns 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 |