8namespace albert{
class Icon; }
20 template<
typename T_ID = QString,
21 typename T_TEXT = QString,
22 typename T_SUBTEXT = QString,
23 typename T_ICON_FACTORY = std::function<std::unique_ptr<Icon>()>,
24 typename T_ACTIONS = std::vector<Action>,
25 typename T_INPUTACTION = QString>
26 requires(std::same_as<std::remove_cvref_t<T_ID>, QString>
27 && std::same_as<std::remove_cvref_t<T_TEXT>, QString>
28 && std::same_as<std::remove_cvref_t<T_SUBTEXT>, QString>
29 && std::convertible_to<std::remove_cvref_t<T_ICON_FACTORY>, std::function<std::unique_ptr<Icon>()>>
30 && std::same_as<std::remove_cvref_t<T_ACTIONS>, std::vector<Action>>
31 && std::same_as<std::remove_cvref_t<T_INPUTACTION>, QString>)
35 T_ICON_FACTORY &&icon_factory,
36 T_ACTIONS &&actions = std::vector<Action>{},
37 T_INPUTACTION &&input_action_text = QString{})
noexcept :
38 id_(std::forward<T_ID>(id)),
39 text_(std::forward<T_TEXT>(text)),
40 subtext_(std::forward<T_SUBTEXT>(subtext)),
41 icon_factory_(std::forward<T_ICON_FACTORY>(icon_factory)),
42 actions_(std::forward<T_ACTIONS>(actions)),
43 input_action_text_(std::forward<T_INPUTACTION>(input_action_text))
52 template<
typename T_ID = QString,
53 typename T_TEXT = QString,
54 typename T_SUBTEXT = QString,
55 typename T_ICON_FACTORY = std::function<std::unique_ptr<Icon>()>,
56 typename T_ACTIONS = std::vector<Action>,
57 typename T_INPUTACTION = QString>
58 requires(std::same_as<std::decay_t<T_ID>, QString>
59 && std::same_as<std::decay_t<T_TEXT>, QString>
60 && std::same_as<std::decay_t<T_SUBTEXT>, QString>
61 && std::convertible_to<std::decay_t<T_ICON_FACTORY>, std::function<std::unique_ptr<Icon>()>>
62 && std::same_as<std::decay_t<T_ACTIONS>, std::vector<Action>>
63 && std::same_as<std::decay_t<T_INPUTACTION>, QString>)
64 static std::shared_ptr<StandardItem>
make(T_ID &&
id,
67 T_ICON_FACTORY &&icon_factory,
68 T_ACTIONS &&actions = std::vector<Action>{},
69 T_INPUTACTION &&input_action_text = QString{})
noexcept
71 return std::make_shared<StandardItem>(std::forward<T_ID>(
id),
72 std::forward<T_TEXT>(text),
73 std::forward<T_SUBTEXT>(subtext),
74 std::forward<T_ICON_FACTORY>(icon_factory),
75 std::forward<T_ACTIONS>(actions),
76 std::forward<T_INPUTACTION>(input_action_text));
112 QString
id()
const override;
116 std::unique_ptr<Icon>
icon()
const override;
Result items displayed in the query results list.
Definition item.h:55
General purpose Item implementation.
Definition standarditem.h:16
void setActions(std::vector< Action > actions)
Sets the item actions to actions.
void setIconFactory(std::function< std::unique_ptr< Icon >()> icon_factory)
Sets the item factory to icon_factory.
QString subtext() const override
Returns the item subtext.
QString id() const override
Returns the item identifier.
void setId(QString id)
Sets the item identifier to id.
QString text() const override
Returns the item text.
std::function< std::unique_ptr< Icon >()> iconFactory()
Returns the item icon factory.
std::vector< Action > actions_
Definition standarditem.h:124
StandardItem & operator=(const StandardItem &)=delete
QString subtext_
Definition standarditem.h:122
std::function< std::unique_ptr< Icon >()> icon_factory_
Definition standarditem.h:123
StandardItem(StandardItem &&other) noexcept=default
Constructs a StandardItem with the contents of other using move semantics.
QString text_
Definition standarditem.h:121
std::vector< Action > actions() const override
Returns item actions.
QString id_
Definition standarditem.h:120
~StandardItem()
Destructs the StandardItem.
QString inputActionText() const override
Returns the input action text.
void setText(QString text)
Sets the item text to text.
void setInputActionText(QString text)
Sets the item input action text to text.
void setSubtext(QString text)
Sets the item subtext to text.
StandardItem & operator=(StandardItem &&other) noexcept=default
Replaces the contents with those of other using move semantics.
StandardItem(const StandardItem &)=delete
QString input_action_text_
Definition standarditem.h:125
std::unique_ptr< Icon > icon() const override
Returns the item icon.
static std::shared_ptr< StandardItem > make(T_ID &&id, T_TEXT &&text, T_SUBTEXT &&subtext, T_ICON_FACTORY &&icon_factory, T_ACTIONS &&actions=std::vector< Action >{}, T_INPUTACTION &&input_action_text=QString{}) noexcept
Constructs a shared_ptr holding a StandardItem with the contents initialized with the data passed.
Definition standarditem.h:64
StandardItem(T_ID &&id, T_TEXT &&text, T_SUBTEXT &&subtext, T_ICON_FACTORY &&icon_factory, T_ACTIONS &&actions=std::vector< Action >{}, T_INPUTACTION &&input_action_text=QString{}) noexcept
Constructs a StandardItem with the contents initialized with the data passed.
Definition standarditem.h:32
Albert utility namespace.
Definition albert.h:14
Albert core interface namespace.
Definition albert.h:14