Krita

InfoObject.h
1 /*
2  * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 #ifndef LIBKIS_INFOOBJECT_H
7 #define LIBKIS_INFOOBJECT_H
8 
9 #include <QObject>
10 #include <kis_properties_configuration.h>
11 
12 #include "kritalibkis_export.h"
13 #include "libkis.h"
14 
15 /**
16  * InfoObject wrap a properties map. These maps can be used to set the
17  * configuration for filters.
18  */
19 class KRITALIBKIS_EXPORT InfoObject : public QObject
20 {
21  Q_OBJECT
22 
23 public:
24  InfoObject(KisPropertiesConfigurationSP configuration);
25 
26  /**
27  * Create a new, empty InfoObject.
28  */
29  explicit InfoObject(QObject *parent = 0);
30  ~InfoObject() override;
31 
32  bool operator==(const InfoObject &other) const;
33  bool operator!=(const InfoObject &other) const;
34  /**
35  * Return all properties this InfoObject manages.
36  */
37  QMap<QString, QVariant> properties() const;
38 
39  /**
40  * Add all properties in the @p propertyMap to this InfoObject
41  */
42  void setProperties(QMap<QString, QVariant> propertyMap);
43 
44 public Q_SLOTS:
45  /**
46  * set the property identified by @p key to @p value
47  *
48  * If you want create a property that represents a color, you can use a QColor
49  * or hex string, as defined in https://doc.qt.io/qt-5/qcolor.html#setNamedColor.
50  *
51  */
52  void setProperty(const QString &key, QVariant value);
53 
54  /**
55  * return the value for the property identified by key, or None if there is no such key.
56  */
57  QVariant property(const QString &key);
58 
59 private:
60 
61  friend class Filter;
62  friend class Document;
63  friend class Node;
64  /**
65  * @brief configuration gives access to the internal configuration object. Must
66  * be used internally in libkis
67  * @return the internal configuration object.
68  */
69  KisPropertiesConfigurationSP configuration() const;
70 
71  struct Private;
72  Private *d;
73 
74 };
75 
76 #endif // LIBKIS_INFOOBJECT_H
InfoObject wrap a properties map.
Definition: InfoObject.h:19
Q_SLOTSQ_SLOTS
The Document class encapsulates a Krita Document/Image.
Definition: Document.h:33
Filter: represents a filter and its configuration.
Definition: Filter.h:30
bool setProperty(const char *name, const QVariant &value)
Node represents a layer or mask in a Krita image's Node hierarchy.
Definition: Node.h:21
QVariant property(const char *name) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Oct 1 2023 03:58:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.