Krita Source Code Documentation
Loading...
Searching...
No Matches
TagActions.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2020 Agata Cacko <cacko.azh@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7#ifndef TAGACTIONS_H
8#define TAGACTIONS_H
9
10#include <QWidgetAction>
11#include <QLabel>
12#include <QLineEdit>
13#include <QPushButton>
14
15#include <KoResource.h>
16
17#include <KisTag.h>
18#include <KisTagModel.h>
19
20#include <kritaresourcewidgets_export.h>
21
22
23// ########### Actions ###########
30class SimpleExistingTagAction : public QAction
31{
32 Q_OBJECT
33public:
34 explicit SimpleExistingTagAction(KoResourceSP resource, KisTagSP tag, QObject* parent = 0);
35 ~SimpleExistingTagAction() override;
36
37Q_SIGNALS:
38 void triggered(KisTagSP tag, KoResourceSP resource);
39
40protected Q_SLOTS:
41 void onTriggered();
42
43private:
52};
53
54
55// ########### Line Edit Actions ###########
56// ---------------------------
64
72class KRITARESOURCEWIDGETS_EXPORT LineEditAction : public QWidgetAction
73{
74 Q_OBJECT
75protected:
76 LineEditAction(QObject* parent);
77
78public:
79 ~LineEditAction() override;
80 void setIcon(const QIcon &icon);
81 void setCloseParentOnTrigger(bool closeParent);
82 bool closeParentOnTrigger();
83
84 void setPlaceholderText(const QString& clickMessage);
85 void setText(const QString& text);
86 void setVisible(bool showAction);
87
88protected Q_SLOTS:
89
96 void slotActionTriggered();
97
104 virtual void onTriggered() {}
105
110 QString userText();
111
112private:
114 QLabel *m_label;
115 QLineEdit *m_editBox;
116 QPushButton *m_AddButton;
117};
118
130class KRITARESOURCEWIDGETS_EXPORT UserInputTagAction : public LineEditAction
131{
132 Q_OBJECT
133
134public:
135 explicit UserInputTagAction(QObject* parent);
136 ~UserInputTagAction() override;
137
138Q_SIGNALS:
139 void triggered(const QString &newTagName);
140
141protected Q_SLOTS:
142 void onTriggered() override;
143};
144
156{
157 Q_OBJECT
158
159public:
160 explicit NewTagResourceAction(KoResourceSP resource, QObject* parent);
161 ~NewTagResourceAction() override;
162
163 void setResource(KoResourceSP resource);
164
165Q_SIGNALS:
166 void triggered(const QString &newTagName, KoResourceSP resource);
167
168protected Q_SLOTS:
169
170 void onTriggered() override;
171
172private:
174};
175
176// ########### Tag Comparer ###########
177
217
218
219#endif // TAGACTIONS_H
The CompareWithOtherTagFunctor class defines a comparer for tags.
Definition TagActions.h:186
KisTagSP m_referenceTag
Tag to compare all other tags to.
Definition TagActions.h:188
KisTagSP referenceTag()
referenceTag is a getter for the reference tag
bool operator()(KisTagSP otherTag)
operator () contains comparison logic
void setReferenceTag(KisTagSP referenceTag)
setReferenceTag sets a reference tag in the comparer
CompareWithOtherTagFunctor(KisTagSP referenceTag)
CompareWithOtherTagFunctor defines a default constructor.
The LineEditAction class defines an action with a user text input.
Definition TagActions.h:73
bool m_closeParentOnTrigger
Definition TagActions.h:113
virtual void onTriggered()
onTriggered defines additional behaviour for the action
Definition TagActions.h:104
QPushButton * m_AddButton
Definition TagActions.h:116
QLabel * m_label
Definition TagActions.h:114
QLineEdit * m_editBox
Definition TagActions.h:115
The NewTagResourceAction class defines an action that sends a signal with QString and a saved resourc...
Definition TagActions.h:156
KoResourceSP m_resource
Definition TagActions.h:173
void onTriggered() override
void setResource(KoResourceSP resource)
~NewTagResourceAction() override
NewTagResourceAction(KoResourceSP resource, QObject *parent)
void triggered(const QString &newTagName, KoResourceSP resource)
The SimpleExistingTagAction class defines an action that holds a resource and a tag.
Definition TagActions.h:31
KisTagSP m_tag
m_tag tag associated with the action
Definition TagActions.h:51
SimpleExistingTagAction(KoResourceSP resource, KisTagSP tag, QObject *parent=0)
KoResourceSP m_resource
m_resource resource associated with the action
Definition TagActions.h:47
void triggered(KisTagSP tag, KoResourceSP resource)
~SimpleExistingTagAction() override
The UserInputTagAction class defines an action with user text input that sends a signal with a simple...
Definition TagActions.h:131
void triggered(const QString &newTagName)