@@ -74,6 +74,70 @@ class QgsLayoutItemAbstractMetadata
74
74
75
75
76
76
77
+ class QgsLayoutMultiFrameAbstractMetadata
78
+ {
79
+ %Docstring
80
+ Stores metadata about one layout multiframe class.
81
+
82
+ A companion class, QgsLayoutMultiFrameAbstractGuiMetadata, handles the
83
+ GUI behavior of QgsLayoutMultiFrames.
84
+
85
+ .. note::
86
+
87
+ In C++ you can use QgsLayoutMultiFrameMetadata convenience class.
88
+ .. versionadded:: 3.0
89
+ %End
90
+
91
+ %TypeHeaderCode
92
+ #include "qgslayoutitemregistry.h"
93
+ %End
94
+ public:
95
+
96
+ QgsLayoutMultiFrameAbstractMetadata( int type, const QString &visibleName );
97
+ %Docstring
98
+ Constructor for QgsLayoutMultiFrameAbstractMetadata with the specified class ``type``
99
+ and ``visibleName``.
100
+ %End
101
+
102
+ virtual ~QgsLayoutMultiFrameAbstractMetadata();
103
+
104
+ int type() const;
105
+ %Docstring
106
+ Returns the unique item type code for the layout multiframe class.
107
+ :rtype: int
108
+ %End
109
+
110
+ virtual QIcon icon() const;
111
+ %Docstring
112
+ Returns an icon representing the layout multiframe type.
113
+ :rtype: QIcon
114
+ %End
115
+
116
+ QString visibleName() const;
117
+ %Docstring
118
+ Returns a translated, user visible name for the layout multiframe class.
119
+ :rtype: str
120
+ %End
121
+
122
+ virtual QgsLayoutMultiFrame *createMultiFrame( QgsLayout *layout ) = 0 /Factory/;
123
+ %Docstring
124
+ Creates a layout multiframe of this class for a specified ``layout``.
125
+ :rtype: QgsLayoutMultiFrame
126
+ %End
127
+
128
+ virtual void resolvePaths( QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving );
129
+ %Docstring
130
+ Resolve paths in the item's ``properties`` (if there are any paths).
131
+ When ``saving`` is true, paths are converted from absolute to relative,
132
+ when ``saving`` is false, paths are converted from relative to absolute.
133
+ This ensures that paths in project files can be relative, but in item
134
+ instances the paths are always absolute.
135
+ %End
136
+
137
+ };
138
+
139
+
140
+
77
141
78
142
79
143
class QgsLayoutItemRegistry : QObject
@@ -111,6 +175,9 @@ class QgsLayoutItemRegistry : QObject
111
175
LayoutPolyline,
112
176
LayoutFrame,
113
177
178
+ // known
179
+ LayoutHtml,
180
+
114
181
// item
115
182
PluginItem,
116
183
};
@@ -139,21 +206,46 @@ class QgsLayoutItemRegistry : QObject
139
206
%Docstring
140
207
Returns the metadata for the specified item ``type``. Returns None if
141
208
a corresponding type was not found in the registry.
209
+ .. seealso:: multiFrameMetadata()
142
210
:rtype: QgsLayoutItemAbstractMetadata
143
211
%End
144
212
213
+ QgsLayoutMultiFrameAbstractMetadata *multiFrameMetadata( int type ) const;
214
+ %Docstring
215
+ Returns the metadata for the specified multiframe ``type``. Returns None if
216
+ a corresponding type was not found in the registry.
217
+ .. seealso:: itemMetadata()
218
+ :rtype: QgsLayoutMultiFrameAbstractMetadata
219
+ %End
220
+
145
221
bool addLayoutItemType( QgsLayoutItemAbstractMetadata *metadata /Transfer/ );
146
222
%Docstring
147
223
Registers a new layout item type. Takes ownership of the metadata instance.
224
+ .. seealso:: addLayoutMultiFrameType()
225
+ :rtype: bool
226
+ %End
227
+
228
+ bool addLayoutMultiFrameType( QgsLayoutMultiFrameAbstractMetadata *metadata /Transfer/ );
229
+ %Docstring
230
+ Registers a new layout multiframe type. Takes ownership of the metadata instance.
231
+ .. seealso:: addLayoutItemType()
148
232
:rtype: bool
149
233
%End
150
234
151
235
QgsLayoutItem *createItem( int type, QgsLayout *layout ) const /Factory/;
152
236
%Docstring
153
237
Creates a new instance of a layout item given the item ``type``, and target ``layout``.
238
+ .. seealso:: createMultiFrame()
154
239
:rtype: QgsLayoutItem
155
240
%End
156
241
242
+ QgsLayoutMultiFrame *createMultiFrame( int type, QgsLayout *layout ) const /Factory/;
243
+ %Docstring
244
+ Creates a new instance of a layout multiframe given the multiframe ``type``, and target ``layout``.
245
+ .. seealso:: createItem()
246
+ :rtype: QgsLayoutMultiFrame
247
+ %End
248
+
157
249
void resolvePaths( int type, QVariantMap &properties, const QgsPathResolver &pathResolver, bool saving ) const;
158
250
%Docstring
159
251
Resolve paths in properties of a particular symbol layer.
@@ -175,6 +267,12 @@ class QgsLayoutItemRegistry : QObject
175
267
``type`` and visible ``name``.
176
268
%End
177
269
270
+ void multiFrameTypeAdded( int type, const QString &name );
271
+ %Docstring
272
+ Emitted whenever a new multiframe type is added to the registry, with the specified
273
+ ``type`` and visible ``name``.
274
+ %End
275
+
178
276
private:
179
277
QgsLayoutItemRegistry( const QgsLayoutItemRegistry &rh );
180
278
};
0 commit comments