Skip to content
Permalink
Browse files

Start porting label item

  • Loading branch information
nyalldawson committed Oct 24, 2017
1 parent 87d497e commit 83f177c1d269a5a00b9231d8a4dd4e4c40e8c89d
@@ -189,6 +189,7 @@ Get font color
%End

public slots:

void refreshExpressionContext();


@@ -168,7 +168,6 @@
%Include layout/qgslayoutsize.sip
%Include layout/qgslayoutsnapper.sip
%Include layout/qgslayoutundocommand.sip
%Include layout/qgslayoutundostack.sip
%Include layout/qgslayoututils.sip
%Include metadata/qgslayermetadata.sip
%Include metadata/qgslayermetadatavalidator.sip
@@ -408,6 +407,7 @@
%Include layout/qgslayoutguidecollection.sip
%Include layout/qgslayoutitem.sip
%Include layout/qgslayoutitemgroup.sip
%Include layout/qgslayoutitemlabel.sip
%Include layout/qgslayoutitemmap.sip
%Include layout/qgslayoutitemmapgrid.sip
%Include layout/qgslayoutitemmapitem.sip
@@ -422,6 +422,7 @@
%Include layout/qgslayoutmodel.sip
%Include layout/qgslayoutpagecollection.sip
%Include layout/qgslayoutobject.sip
%Include layout/qgslayoutundostack.sip
%Include symbology/qgscptcityarchive.sip
%Include symbology/qgssvgcache.sip
%Include symbology/qgsstyle.sip
@@ -0,0 +1,224 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitemlabel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsLayoutItemLabel: QgsLayoutItem
{
%Docstring
A layout item subclass for text labels.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgslayoutitemlabel.h"
%End
public:

enum Mode
{
ModeFont,
ModeHtml,
};

QgsLayoutItemLabel( QgsLayout *layout );
%Docstring
Constructor for QgsLayoutItemLabel, with the specified parent ``layout``.
%End

static QgsLayoutItemLabel *create( QgsLayout *layout ) /Factory/;
%Docstring
Returns a new label item for the specified ``layout``.

The caller takes responsibility for deleting the returned object.
:rtype: QgsLayoutItemLabel
%End


virtual int type() const;

virtual QString stringType() const;

virtual QString displayName() const;

void adjustSizeToText();
%Docstring
Resizes the item so that the label's text fits to the item. Keeps the top left point stationary.
%End

QString text();
%Docstring
Returns the label's preset text.
.. seealso:: currentText()
.. seealso:: setText()
:rtype: str
%End

void setText( const QString &text );
%Docstring
Sets the label's preset ``text``.
.. seealso:: text()
%End

QString currentText() const;
%Docstring
Returns the text as it appears on the label (with evaluated expressions
and other dynamic content).
.. seealso:: text()
:rtype: str
%End

Mode mode() const;
%Docstring
Returns the label's current mode.
.. seealso:: setMode()
:rtype: Mode
%End

void setMode( Mode mode );
%Docstring
Sets the label's current ``mode``, allowing the label
to switch between font based and HTML based rendering.
.. seealso:: mode()
%End

QFont font() const;
%Docstring
Returns the label's current font.
.. seealso:: setFont()
:rtype: QFont
%End

void setFont( const QFont &font );
%Docstring
Sets the label's current ``font``.
.. seealso:: font()
%End

Qt::AlignmentFlag vAlign() const;
%Docstring
Returns for the vertical alignment of the label.
.. seealso:: setVAlign()
.. seealso:: hAlign()
:rtype: Qt.AlignmentFlag
%End

Qt::AlignmentFlag hAlign() const;
%Docstring
Returns the horizontal alignment of the label.
.. seealso:: vAlign()
.. seealso:: setHAlign()
:rtype: Qt.AlignmentFlag
%End

void setHAlign( Qt::AlignmentFlag alignment );
%Docstring
Sets the horizontal ``alignment`` of the label.
.. seealso:: hAlign()
.. seealso:: setVAlign()
%End

void setVAlign( Qt::AlignmentFlag alignment );
%Docstring
Sets for the vertical ``alignment`` of the label.
.. seealso:: vAlign()
.. seealso:: setHAlign()
%End

double marginX() const;
%Docstring
Returns the horizontal margin between the edge of the frame and the label
contents, in layout units.
.. seealso:: setMargin()
.. seealso:: marginY()
:rtype: float
%End

double marginY() const;
%Docstring
Returns the vertical margin between the edge of the frame and the label
contents, in layout units.
.. seealso:: setMargin()
.. seealso:: marginX()
:rtype: float
%End

void setMargin( double margin );
%Docstring
Sets the ``margin`` between the edge of the frame and the label contents.
This method sets both the horizontal and vertical margins to the same
value. The margins can be individually controlled using the setMarginX()
and setMarginY() methods.

Margins are set using the current layout units.

.. seealso:: setMarginX()
.. seealso:: setMarginY()
%End

void setMarginX( double margin );
%Docstring
Sets the horizontal ``margin`` between the edge of the frame and the label
contents, in layout units.
.. seealso:: setMargin()
.. seealso:: setMarginY()
%End

void setMarginY( double margin );
%Docstring
Sets the vertical ``margin`` between the edge of the frame and the label
contents, in layout units.
.. seealso:: setMargin()
.. seealso:: setMarginX()
%End

void setFontColor( const QColor &color );
%Docstring
Sets the label font ``color``.
.. seealso:: fontColor()
%End

QColor fontColor() const;
%Docstring
Returns the label font color.
.. seealso:: setFontColor()
:rtype: QColor
%End

virtual QRectF boundingRect() const;


virtual void setFrameEnabled( const bool drawFrame );


virtual void setFrameStrokeWidth( const QgsLayoutMeasurement &strokeWidth );


public slots:

virtual void refresh();


protected:
virtual void draw( QgsRenderContext &context, const QStyleOptionGraphicsItem *itemStyle = 0 );

virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context );


};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgslayoutitemlabel.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -104,6 +104,7 @@ class QgsLayoutItemRegistry : QObject
LayoutPage,
LayoutMap,
LayoutPicture,
LayoutLabel,
LayoutShape,
LayoutPolygon,
LayoutPolyline,
@@ -369,6 +369,7 @@ SET(QGIS_CORE_SRCS
layout/qgslayoutitem.cpp
layout/qgslayoutitemgroup.cpp
layout/qgslayoutitemgroupundocommand.cpp
layout/qgslayoutitemlabel.cpp
layout/qgslayoutitemmap.cpp
layout/qgslayoutitemmapgrid.cpp
layout/qgslayoutitemmapitem.cpp
@@ -728,6 +729,7 @@ SET(QGIS_CORE_MOC_HDRS
layout/qgslayoutitem.h
layout/qgslayoutitemgroup.h
layout/qgslayoutitemgroupundocommand.h
layout/qgslayoutitemlabel.h
layout/qgslayoutitemmap.h
layout/qgslayoutitemmapgrid.h
layout/qgslayoutitemmapitem.h
@@ -170,6 +170,7 @@ class CORE_EXPORT QgsComposerLabel: public QgsComposerItem
virtual void setFrameStrokeWidth( const double strokeWidth ) override;

public slots:

void refreshExpressionContext();


0 comments on commit 83f177c

Please sign in to comment.
You can’t perform that action at this time.