2017-10-24 14:18:21 +10:00
|
|
|
/************************************************************************
|
|
|
|
* 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
|
2017-12-15 10:36:55 -04:00
|
|
|
A layout item subclass for text labels.
|
|
|
|
|
2017-10-24 14:18:21 +10:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgslayoutitemlabel.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum Mode
|
|
|
|
{
|
|
|
|
ModeFont,
|
|
|
|
ModeHtml,
|
|
|
|
};
|
|
|
|
|
|
|
|
QgsLayoutItemLabel( QgsLayout *layout );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor for QgsLayoutItemLabel, with the specified parent ``layout``.
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
static QgsLayoutItemLabel *create( QgsLayout *layout ) /Factory/;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a new label item for the specified ``layout``.
|
|
|
|
|
|
|
|
The caller takes responsibility for deleting the returned object.
|
2017-10-24 14:18:21 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:rtype: QgsLayoutItemLabel
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual int type() const;
|
|
|
|
|
|
|
|
virtual QString displayName() const;
|
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-10-24 14:18:21 +10:00
|
|
|
void adjustSizeToText();
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Resizes the item so that the label's text fits to the item. Keeps the top left point stationary.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`sizeForText()`
|
2017-10-24 14:50:17 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
QSizeF sizeForText() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the required item size (in layout units) for the label's text to fill the item.
|
|
|
|
|
|
|
|
:rtype: QSizeF
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`adjustSizeToText()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
QString text();
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the label's preset text.
|
|
|
|
|
|
|
|
:rtype: str
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`currentText()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setText()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setText( const QString &text );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the label's preset ``text``.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`text()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
QString currentText() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the text as it appears on the label (with evaluated expressions
|
|
|
|
and other dynamic content).
|
|
|
|
|
|
|
|
:rtype: str
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`text()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
Mode mode() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the label's current mode.
|
|
|
|
|
|
|
|
:rtype: Mode
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMode()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setMode( Mode mode );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the label's current ``mode``, allowing the label
|
|
|
|
to switch between font based and HTML based rendering.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`mode()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
QFont font() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the label's current font.
|
|
|
|
|
|
|
|
:rtype: QFont
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setFont()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setFont( const QFont &font );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the label's current ``font``.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`font()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
Qt::AlignmentFlag vAlign() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns for the vertical alignment of the label.
|
|
|
|
|
|
|
|
:rtype: Qt.AlignmentFlag
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setVAlign()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`hAlign()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
Qt::AlignmentFlag hAlign() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the horizontal alignment of the label.
|
|
|
|
|
|
|
|
:rtype: Qt.AlignmentFlag
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`vAlign()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setHAlign()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setHAlign( Qt::AlignmentFlag alignment );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the horizontal ``alignment`` of the label.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`hAlign()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setVAlign()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setVAlign( Qt::AlignmentFlag alignment );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets for the vertical ``alignment`` of the label.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`vAlign()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setHAlign()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
double marginX() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the horizontal margin between the edge of the frame and the label
|
|
|
|
contents, in layout units.
|
|
|
|
|
|
|
|
:rtype: float
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMargin()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`marginY()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
double marginY() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the vertical margin between the edge of the frame and the label
|
|
|
|
contents, in layout units.
|
|
|
|
|
|
|
|
:rtype: float
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMargin()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`marginX()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setMargin( double margin );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
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.
|
2017-10-24 14:18:21 +10:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Margins are set using the current layout units.
|
2017-10-24 14:18:21 +10:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMarginX()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMarginY()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setMarginX( double margin );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the horizontal ``margin`` between the edge of the frame and the label
|
|
|
|
contents, in layout units.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMargin()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMarginY()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setMarginY( double margin );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the vertical ``margin`` between the edge of the frame and the label
|
|
|
|
contents, in layout units.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMargin()`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setMarginX()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setFontColor( const QColor &color );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the label font ``color``.
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`fontColor()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
QColor fontColor() const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the label font color.
|
|
|
|
|
|
|
|
:rtype: QColor
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setFontColor()`
|
2017-10-24 14:18:21 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
virtual QRectF boundingRect() const;
|
|
|
|
|
|
|
|
|
2017-11-07 19:03:44 +01:00
|
|
|
virtual void setFrameEnabled( bool drawFrame );
|
2017-10-24 14:18:21 +10:00
|
|
|
|
|
|
|
|
|
|
|
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 *
|
|
|
|
************************************************************************/
|