Skip to content

Commit 83f177c

Browse files
committedNov 7, 2017
Start porting label item
1 parent 87d497e commit 83f177c

File tree

16 files changed

+1495
-1
lines changed

16 files changed

+1495
-1
lines changed
 

‎python/core/composer/qgscomposerlabel.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ Get font color
189189
%End
190190

191191
public slots:
192+
192193
void refreshExpressionContext();
193194

194195

‎python/core/core_auto.sip

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@
168168
%Include layout/qgslayoutsize.sip
169169
%Include layout/qgslayoutsnapper.sip
170170
%Include layout/qgslayoutundocommand.sip
171-
%Include layout/qgslayoutundostack.sip
172171
%Include layout/qgslayoututils.sip
173172
%Include metadata/qgslayermetadata.sip
174173
%Include metadata/qgslayermetadatavalidator.sip
@@ -408,6 +407,7 @@
408407
%Include layout/qgslayoutguidecollection.sip
409408
%Include layout/qgslayoutitem.sip
410409
%Include layout/qgslayoutitemgroup.sip
410+
%Include layout/qgslayoutitemlabel.sip
411411
%Include layout/qgslayoutitemmap.sip
412412
%Include layout/qgslayoutitemmapgrid.sip
413413
%Include layout/qgslayoutitemmapitem.sip
@@ -422,6 +422,7 @@
422422
%Include layout/qgslayoutmodel.sip
423423
%Include layout/qgslayoutpagecollection.sip
424424
%Include layout/qgslayoutobject.sip
425+
%Include layout/qgslayoutundostack.sip
425426
%Include symbology/qgscptcityarchive.sip
426427
%Include symbology/qgssvgcache.sip
427428
%Include symbology/qgsstyle.sip
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/layout/qgslayoutitemlabel.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
class QgsLayoutItemLabel: QgsLayoutItem
13+
{
14+
%Docstring
15+
A layout item subclass for text labels.
16+
.. versionadded:: 3.0
17+
%End
18+
19+
%TypeHeaderCode
20+
#include "qgslayoutitemlabel.h"
21+
%End
22+
public:
23+
24+
enum Mode
25+
{
26+
ModeFont,
27+
ModeHtml,
28+
};
29+
30+
QgsLayoutItemLabel( QgsLayout *layout );
31+
%Docstring
32+
Constructor for QgsLayoutItemLabel, with the specified parent ``layout``.
33+
%End
34+
35+
static QgsLayoutItemLabel *create( QgsLayout *layout ) /Factory/;
36+
%Docstring
37+
Returns a new label item for the specified ``layout``.
38+
39+
The caller takes responsibility for deleting the returned object.
40+
:rtype: QgsLayoutItemLabel
41+
%End
42+
43+
44+
virtual int type() const;
45+
46+
virtual QString stringType() const;
47+
48+
virtual QString displayName() const;
49+
50+
void adjustSizeToText();
51+
%Docstring
52+
Resizes the item so that the label's text fits to the item. Keeps the top left point stationary.
53+
%End
54+
55+
QString text();
56+
%Docstring
57+
Returns the label's preset text.
58+
.. seealso:: currentText()
59+
.. seealso:: setText()
60+
:rtype: str
61+
%End
62+
63+
void setText( const QString &text );
64+
%Docstring
65+
Sets the label's preset ``text``.
66+
.. seealso:: text()
67+
%End
68+
69+
QString currentText() const;
70+
%Docstring
71+
Returns the text as it appears on the label (with evaluated expressions
72+
and other dynamic content).
73+
.. seealso:: text()
74+
:rtype: str
75+
%End
76+
77+
Mode mode() const;
78+
%Docstring
79+
Returns the label's current mode.
80+
.. seealso:: setMode()
81+
:rtype: Mode
82+
%End
83+
84+
void setMode( Mode mode );
85+
%Docstring
86+
Sets the label's current ``mode``, allowing the label
87+
to switch between font based and HTML based rendering.
88+
.. seealso:: mode()
89+
%End
90+
91+
QFont font() const;
92+
%Docstring
93+
Returns the label's current font.
94+
.. seealso:: setFont()
95+
:rtype: QFont
96+
%End
97+
98+
void setFont( const QFont &font );
99+
%Docstring
100+
Sets the label's current ``font``.
101+
.. seealso:: font()
102+
%End
103+
104+
Qt::AlignmentFlag vAlign() const;
105+
%Docstring
106+
Returns for the vertical alignment of the label.
107+
.. seealso:: setVAlign()
108+
.. seealso:: hAlign()
109+
:rtype: Qt.AlignmentFlag
110+
%End
111+
112+
Qt::AlignmentFlag hAlign() const;
113+
%Docstring
114+
Returns the horizontal alignment of the label.
115+
.. seealso:: vAlign()
116+
.. seealso:: setHAlign()
117+
:rtype: Qt.AlignmentFlag
118+
%End
119+
120+
void setHAlign( Qt::AlignmentFlag alignment );
121+
%Docstring
122+
Sets the horizontal ``alignment`` of the label.
123+
.. seealso:: hAlign()
124+
.. seealso:: setVAlign()
125+
%End
126+
127+
void setVAlign( Qt::AlignmentFlag alignment );
128+
%Docstring
129+
Sets for the vertical ``alignment`` of the label.
130+
.. seealso:: vAlign()
131+
.. seealso:: setHAlign()
132+
%End
133+
134+
double marginX() const;
135+
%Docstring
136+
Returns the horizontal margin between the edge of the frame and the label
137+
contents, in layout units.
138+
.. seealso:: setMargin()
139+
.. seealso:: marginY()
140+
:rtype: float
141+
%End
142+
143+
double marginY() const;
144+
%Docstring
145+
Returns the vertical margin between the edge of the frame and the label
146+
contents, in layout units.
147+
.. seealso:: setMargin()
148+
.. seealso:: marginX()
149+
:rtype: float
150+
%End
151+
152+
void setMargin( double margin );
153+
%Docstring
154+
Sets the ``margin`` between the edge of the frame and the label contents.
155+
This method sets both the horizontal and vertical margins to the same
156+
value. The margins can be individually controlled using the setMarginX()
157+
and setMarginY() methods.
158+
159+
Margins are set using the current layout units.
160+
161+
.. seealso:: setMarginX()
162+
.. seealso:: setMarginY()
163+
%End
164+
165+
void setMarginX( double margin );
166+
%Docstring
167+
Sets the horizontal ``margin`` between the edge of the frame and the label
168+
contents, in layout units.
169+
.. seealso:: setMargin()
170+
.. seealso:: setMarginY()
171+
%End
172+
173+
void setMarginY( double margin );
174+
%Docstring
175+
Sets the vertical ``margin`` between the edge of the frame and the label
176+
contents, in layout units.
177+
.. seealso:: setMargin()
178+
.. seealso:: setMarginX()
179+
%End
180+
181+
void setFontColor( const QColor &color );
182+
%Docstring
183+
Sets the label font ``color``.
184+
.. seealso:: fontColor()
185+
%End
186+
187+
QColor fontColor() const;
188+
%Docstring
189+
Returns the label font color.
190+
.. seealso:: setFontColor()
191+
:rtype: QColor
192+
%End
193+
194+
virtual QRectF boundingRect() const;
195+
196+
197+
virtual void setFrameEnabled( const bool drawFrame );
198+
199+
200+
virtual void setFrameStrokeWidth( const QgsLayoutMeasurement &strokeWidth );
201+
202+
203+
public slots:
204+
205+
virtual void refresh();
206+
207+
208+
protected:
209+
virtual void draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 );
210+
211+
virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
212+
213+
virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );
214+
215+
216+
};
217+
218+
/************************************************************************
219+
* This file has been generated automatically from *
220+
* *
221+
* src/core/layout/qgslayoutitemlabel.h *
222+
* *
223+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
224+
************************************************************************/

‎python/core/layout/qgslayoutitemregistry.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class QgsLayoutItemRegistry : QObject
104104
LayoutPage,
105105
LayoutMap,
106106
LayoutPicture,
107+
LayoutLabel,
107108
LayoutShape,
108109
LayoutPolygon,
109110
LayoutPolyline,

‎src/core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ SET(QGIS_CORE_SRCS
369369
layout/qgslayoutitem.cpp
370370
layout/qgslayoutitemgroup.cpp
371371
layout/qgslayoutitemgroupundocommand.cpp
372+
layout/qgslayoutitemlabel.cpp
372373
layout/qgslayoutitemmap.cpp
373374
layout/qgslayoutitemmapgrid.cpp
374375
layout/qgslayoutitemmapitem.cpp
@@ -728,6 +729,7 @@ SET(QGIS_CORE_MOC_HDRS
728729
layout/qgslayoutitem.h
729730
layout/qgslayoutitemgroup.h
730731
layout/qgslayoutitemgroupundocommand.h
732+
layout/qgslayoutitemlabel.h
731733
layout/qgslayoutitemmap.h
732734
layout/qgslayoutitemmapgrid.h
733735
layout/qgslayoutitemmapitem.h

‎src/core/composer/qgscomposerlabel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class CORE_EXPORT QgsComposerLabel: public QgsComposerItem
170170
virtual void setFrameStrokeWidth( const double strokeWidth ) override;
171171

172172
public slots:
173+
173174
void refreshExpressionContext();
174175

175176

0 commit comments

Comments
 (0)
Please sign in to comment.