2017-06-20 11:14:25 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/composer/qgscomposerlegend.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-22 12:22:12 +07:00
|
|
|
|
2016-12-12 03:27:14 +08:00
|
|
|
class QgsLegendModel : QgsLayerTreeModel
|
2014-08-22 12:22:12 +07:00
|
|
|
{
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Item model implementation based on layer tree model for composer legend.
|
|
|
|
Overrides some functionality of QgsLayerTreeModel to better fit the needs of composer legend.
|
|
|
|
|
|
|
|
.. versionadded:: 2.6
|
2014-08-22 12:22:12 +07:00
|
|
|
%End
|
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgscomposerlegend.h"
|
|
|
|
%End
|
2014-08-22 12:22:12 +07:00
|
|
|
public:
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsLegendModel( QgsLayerTree *rootNode, QObject *parent /TransferThis/ = 0 );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Construct the model based on the given layer tree
|
|
|
|
%End
|
2014-08-22 12:22:12 +07:00
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
virtual QVariant data( const QModelIndex &index, int role ) const;
|
|
|
|
|
|
|
|
|
|
|
|
virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
|
2014-08-22 12:22:12 +07:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
class QgsComposerLegend : QgsComposerItem
|
2009-02-27 13:57:26 +00:00
|
|
|
{
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
A legend that can be placed onto a map composition
|
2009-02-27 13:57:26 +00:00
|
|
|
%End
|
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgscomposerlegend.h"
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
public:
|
2017-06-20 14:26:13 +02:00
|
|
|
QgsComposerLegend( QgsComposition *composition /TransferThis/ );
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2010-11-25 21:45:52 +00:00
|
|
|
virtual int type() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Return correct graphics item type.
|
|
|
|
:rtype: int
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget );
|
2010-11-25 21:45:52 +00:00
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Reimplementation of QCanvasItem.paint
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QSizeF paintAndDetermineSize( QPainter *painter );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Paints the legend and calculates its size. If painter is 0, only size is calculated
|
|
|
|
:rtype: QSizeF
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
|
|
|
|
void adjustBoxSize();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets item box to the whole content
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2016-07-13 15:53:08 +10:00
|
|
|
void setResizeToContents( bool enabled );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets whether the legend should automatically resize to fit its contents.
|
|
|
|
\param enabled set to false to disable automatic resizing. The legend frame will not
|
|
|
|
be expanded to fit legend items, and items may be cropped from display.
|
|
|
|
.. seealso:: resizeToContents()
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-07-13 15:53:08 +10:00
|
|
|
|
|
|
|
bool resizeToContents() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns whether the legend should automatically resize to fit its contents.
|
|
|
|
.. seealso:: setResizeToContents()
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
|
|
|
|
2016-07-13 15:53:08 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsLegendModel *model();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the legend model
|
|
|
|
:rtype: QgsLegendModel
|
|
|
|
%End
|
2014-08-22 12:22:12 +07:00
|
|
|
|
|
|
|
void setAutoUpdateModel( bool autoUpdate );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
%End
|
2014-08-22 12:22:12 +07:00
|
|
|
bool autoUpdateModel() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2014-09-25 12:00:45 +02:00
|
|
|
void setLegendFilterByMapEnabled( bool enabled );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
%End
|
2014-09-25 12:00:45 +02:00
|
|
|
bool legendFilterByMapEnabled() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
.. versionadded:: 2.6
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2014-09-25 12:00:45 +02:00
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
virtual void updateItem();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
.. versionadded:: 2.12
|
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2015-06-26 10:12:58 +02:00
|
|
|
void setLegendFilterOutAtlas( bool doFilter );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
.. versionadded:: 2.14
|
|
|
|
%End
|
2015-06-26 10:12:58 +02:00
|
|
|
|
|
|
|
bool legendFilterOutAtlas() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
.. versionadded:: 2.14
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2015-06-26 10:12:58 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setTitle( const QString &t );
|
2009-02-27 13:57:26 +00:00
|
|
|
QString title() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: str
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2014-04-07 13:55:44 +02:00
|
|
|
Qt::AlignmentFlag titleAlignment() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the alignment of the legend title
|
|
|
|
:return: Qt.AlignmentFlag for the legend title
|
|
|
|
.. versionadded:: 2.3
|
|
|
|
.. seealso:: setTitleAlignment
|
|
|
|
:rtype: Qt.AlignmentFlag
|
|
|
|
%End
|
|
|
|
|
2014-04-07 13:55:44 +02:00
|
|
|
void setTitleAlignment( Qt::AlignmentFlag alignment );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets the alignment of the legend title
|
|
|
|
\param alignment Text alignment for drawing the legend title
|
|
|
|
.. versionadded:: 2.3
|
|
|
|
.. seealso:: titleAlignment
|
|
|
|
%End
|
2014-04-07 13:55:44 +02:00
|
|
|
|
2017-05-03 07:45:22 +02:00
|
|
|
QgsLegendStyle &rstyle( QgsLegendStyle::Style s );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns reference to modifiable style
|
|
|
|
:rtype: QgsLegendStyle
|
|
|
|
%End
|
2016-12-12 03:06:02 +08:00
|
|
|
QgsLegendStyle style( QgsLegendStyle::Style s ) const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns style
|
|
|
|
:rtype: QgsLegendStyle
|
|
|
|
%End
|
2017-05-01 18:13:15 +02:00
|
|
|
void setStyle( QgsLegendStyle::Style s, const QgsLegendStyle &style );
|
2013-06-23 16:00:16 +02:00
|
|
|
|
2016-12-12 03:06:02 +08:00
|
|
|
QFont styleFont( QgsLegendStyle::Style s ) const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: QFont
|
|
|
|
%End
|
2017-05-01 18:13:15 +02:00
|
|
|
void setStyleFont( QgsLegendStyle::Style s, const QFont &f );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Set style font
|
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
|
2016-12-12 03:06:02 +08:00
|
|
|
void setStyleMargin( QgsLegendStyle::Style s, double margin );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Set style margin
|
|
|
|
%End
|
2016-12-12 03:06:02 +08:00
|
|
|
void setStyleMargin( QgsLegendStyle::Style s, QgsLegendStyle::Side side, double margin );
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2016-12-13 12:09:13 +07:00
|
|
|
double lineSpacing() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the spacing in-between lines in mm
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
.. seealso:: setLineSpacing
|
|
|
|
:rtype: float
|
|
|
|
%End
|
|
|
|
|
2016-12-13 12:09:13 +07:00
|
|
|
void setLineSpacing( double spacing );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets the spacing in-between multiple lines
|
|
|
|
\param spacing Double value to use as spacing in between multiple lines
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
.. seealso:: lineSpacing
|
|
|
|
%End
|
2016-12-13 12:09:13 +07:00
|
|
|
|
2009-02-27 13:57:26 +00:00
|
|
|
double boxSpace() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
void setBoxSpace( double s );
|
|
|
|
|
2013-06-23 16:00:16 +02:00
|
|
|
double columnSpace() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
void setColumnSpace( double s );
|
|
|
|
|
|
|
|
QColor fontColor() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: QColor
|
|
|
|
%End
|
2017-05-01 18:13:15 +02:00
|
|
|
void setFontColor( const QColor &c );
|
2013-06-23 16:00:16 +02:00
|
|
|
|
2009-02-27 13:57:26 +00:00
|
|
|
double symbolWidth() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
void setSymbolWidth( double w );
|
|
|
|
|
|
|
|
double symbolHeight() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
void setSymbolHeight( double h );
|
|
|
|
|
2014-01-27 09:22:24 +01:00
|
|
|
double wmsLegendWidth() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2014-01-27 09:22:24 +01:00
|
|
|
void setWmsLegendWidth( double w );
|
|
|
|
|
|
|
|
double wmsLegendHeight() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2014-01-27 09:22:24 +01:00
|
|
|
void setWmsLegendHeight( double h );
|
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setWrapChar( const QString &t );
|
2012-09-24 02:28:15 +02:00
|
|
|
QString wrapChar() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: str
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2013-06-23 16:00:16 +02:00
|
|
|
int columnCount() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: int
|
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
void setColumnCount( int c );
|
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
bool splitLayer() const;
|
|
|
|
%Docstring
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
void setSplitLayer( bool s );
|
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
bool equalColumnWidth() const;
|
|
|
|
%Docstring
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2013-06-23 16:00:16 +02:00
|
|
|
void setEqualColumnWidth( bool s );
|
|
|
|
|
2017-02-22 17:13:57 +10:00
|
|
|
bool drawRasterStroke() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns whether a stroke will be drawn around raster symbol items.
|
|
|
|
.. seealso:: setDrawRasterStroke()
|
|
|
|
.. seealso:: rasterStrokeColor()
|
|
|
|
.. seealso:: rasterStrokeWidth()
|
|
|
|
.. versionadded:: 2.12
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2015-10-08 23:14:18 +11:00
|
|
|
|
2017-02-22 17:13:57 +10:00
|
|
|
void setDrawRasterStroke( bool enabled );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets whether a stroke will be drawn around raster symbol items.
|
|
|
|
\param enabled set to true to draw borders
|
|
|
|
.. seealso:: drawRasterStroke()
|
|
|
|
.. seealso:: setRasterStrokeColor()
|
|
|
|
.. seealso:: setRasterStrokeWidth()
|
|
|
|
.. versionadded:: 2.12
|
|
|
|
%End
|
2015-10-08 23:14:18 +11:00
|
|
|
|
2017-02-22 17:13:57 +10:00
|
|
|
QColor rasterStrokeColor() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the stroke color for the stroke drawn around raster symbol items. The stroke is
|
|
|
|
only drawn if drawRasterStroke() is true.
|
|
|
|
.. seealso:: setRasterStrokeColor()
|
|
|
|
.. seealso:: drawRasterStroke()
|
|
|
|
.. seealso:: rasterStrokeWidth()
|
|
|
|
.. versionadded:: 2.12
|
|
|
|
:rtype: QColor
|
|
|
|
%End
|
2017-02-22 17:13:57 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setRasterStrokeColor( const QColor &color );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets the stroke color for the stroke drawn around raster symbol items. The stroke is
|
|
|
|
only drawn if drawRasterStroke() is true.
|
|
|
|
\param color stroke color
|
|
|
|
.. seealso:: rasterStrokeColor()
|
|
|
|
.. seealso:: setDrawRasterStroke()
|
|
|
|
.. seealso:: setRasterStrokeWidth()
|
|
|
|
.. versionadded:: 2.12
|
|
|
|
%End
|
2015-10-08 23:14:18 +11:00
|
|
|
|
2017-02-22 17:13:57 +10:00
|
|
|
double rasterStrokeWidth() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the stroke width (in millimeters) for the stroke drawn around raster symbol items. The stroke is
|
|
|
|
only drawn if drawRasterStroke() is true.
|
|
|
|
.. seealso:: setRasterStrokeWidth()
|
|
|
|
.. seealso:: drawRasterStroke()
|
|
|
|
.. seealso:: rasterStrokeColor()
|
|
|
|
.. versionadded:: 2.12
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2017-02-22 17:13:57 +10:00
|
|
|
|
|
|
|
void setRasterStrokeWidth( double width );
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets the stroke width for the stroke drawn around raster symbol items. The stroke is
|
|
|
|
only drawn if drawRasterStroke() is true.
|
|
|
|
\param width stroke width in millimeters
|
|
|
|
.. seealso:: rasterStrokeWidth()
|
|
|
|
.. seealso:: setDrawRasterStroke()
|
|
|
|
.. seealso:: setRasterStrokeColor()
|
|
|
|
.. versionadded:: 2.12
|
|
|
|
%End
|
2015-10-08 23:14:18 +11:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setComposerMap( const QgsComposerMap *map );
|
|
|
|
const QgsComposerMap *composerMap() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: QgsComposerMap
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2009-02-27 13:57:26 +00:00
|
|
|
void updateLegend();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Updates the model and all legend entries
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual bool writeXml( QDomElement &elem, QDomDocument &doc ) const;
|
|
|
|
|
|
|
|
%Docstring
|
|
|
|
Stores state in Dom node
|
|
|
|
\param elem is Dom element corresponding to 'Composer' tag
|
|
|
|
\param doc Dom document
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
virtual bool readXml( const QDomElement &itemElem, const QDomDocument &doc );
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets state from Dom document
|
|
|
|
\param itemElem is Dom node corresponding to item tag
|
|
|
|
\param doc is Dom document
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2009-02-27 13:57:26 +00:00
|
|
|
|
2016-02-14 03:50:23 +01:00
|
|
|
virtual QString displayName() const;
|
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
const QgsLegendSettings &legendSettings() const;
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Returns the legend's renderer settings object.
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
:rtype: QgsLegendSettings
|
|
|
|
%End
|
2017-01-17 14:32:30 +10:00
|
|
|
|
2009-02-27 13:57:26 +00:00
|
|
|
public slots:
|
|
|
|
void synchronizeWithModel();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Data changed
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
void invalidateCurrentMap();
|
2017-06-20 11:14:25 +02:00
|
|
|
%Docstring
|
|
|
|
Sets mCompositionMap to 0 if the map is deleted
|
|
|
|
%End
|
|
|
|
|
2017-05-02 07:21:20 +02:00
|
|
|
virtual void refreshDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property = QgsComposerObject::AllProperties, const QgsExpressionContext *context = 0 );
|
2017-01-17 14:32:30 +10:00
|
|
|
|
2017-06-20 11:14:25 +02:00
|
|
|
|
2009-02-28 14:35:45 +00:00
|
|
|
};
|
2017-06-20 11:14:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/composer/qgscomposerlegend.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|