Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stores information relating to the current context (such as associated feature and layer) and rendering settings for a layout.
- Loading branch information
1 parent
d70f53c
commit b2b35dd
Showing
7 changed files
with
424 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutcontext.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
class QgsLayoutContext | ||
{ | ||
%Docstring | ||
Stores information relating to the current context and rendering settings for a layout. | ||
.. versionadded:: 3.0 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgslayoutcontext.h" | ||
%End | ||
public: | ||
|
||
enum Flag | ||
{ | ||
FlagDebug, | ||
FlagOutlineOnly, | ||
FlagAntialiasing, | ||
FlagUseAdvancedEffects, | ||
}; | ||
typedef QFlags<QgsLayoutContext::Flag> Flags; | ||
|
||
|
||
QgsLayoutContext(); | ||
|
||
void setFlags( const QgsLayoutContext::Flags flags ); | ||
%Docstring | ||
Sets the combination of ``flags`` that will be used for rendering the layout. | ||
.. seealso:: setFlag() | ||
.. seealso:: flags() | ||
.. seealso:: testFlag() | ||
%End | ||
|
||
void setFlag( const QgsLayoutContext::Flag flag, const bool on = true ); | ||
%Docstring | ||
Enables or disables a particular rendering ``flag`` for the layout. Other existing | ||
flags are not affected. | ||
.. seealso:: setFlags() | ||
.. seealso:: flags() | ||
.. seealso:: testFlag() | ||
%End | ||
|
||
QgsLayoutContext::Flags flags() const; | ||
%Docstring | ||
Returns the current combination of flags used for rendering the layout. | ||
.. seealso:: setFlags() | ||
.. seealso:: setFlag() | ||
.. seealso:: testFlag() | ||
:rtype: QgsLayoutContext.Flags | ||
%End | ||
|
||
bool testFlag( const Flag flag ) const; | ||
%Docstring | ||
Check whether a particular rendering ``flag`` is enabled for the layout. | ||
.. seealso:: setFlags() | ||
.. seealso:: setFlag() | ||
.. seealso:: flags() | ||
:rtype: bool | ||
%End | ||
|
||
void setFeature( const QgsFeature &feature ); | ||
%Docstring | ||
Sets the current ``feature`` for evaluating the layout. This feature may | ||
be used for altering an item's content and appearance for a report | ||
or atlas layout. | ||
.. seealso:: feature() | ||
%End | ||
|
||
QgsFeature feature() const; | ||
%Docstring | ||
Returns the current feature for evaluating the layout. This feature may | ||
be used for altering an item's content and appearance for a report | ||
or atlas layout. | ||
.. seealso:: setFeature() | ||
:rtype: QgsFeature | ||
%End | ||
|
||
QgsVectorLayer *layer() const; | ||
%Docstring | ||
Returns the vector layer associated with the layout's context. | ||
.. seealso:: setLayer() | ||
:rtype: QgsVectorLayer | ||
%End | ||
|
||
void setLayer( QgsVectorLayer *layer ); | ||
%Docstring | ||
Sets the vector ``layer`` associated with the layout's context. | ||
.. seealso:: layer() | ||
%End | ||
|
||
}; | ||
|
||
|
||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/layout/qgslayoutcontext.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/*************************************************************************** | ||
qgslayoutcontext.cpp | ||
-------------------- | ||
begin : July 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgslayoutcontext.h" | ||
#include "qgsfeature.h" | ||
|
||
|
||
QgsLayoutContext::QgsLayoutContext() | ||
: mFlags( FlagAntialiasing | FlagUseAdvancedEffects ) | ||
{} | ||
|
||
void QgsLayoutContext::setFlags( const QgsLayoutContext::Flags flags ) | ||
{ | ||
mFlags = flags; | ||
} | ||
|
||
void QgsLayoutContext::setFlag( const QgsLayoutContext::Flag flag, const bool on ) | ||
{ | ||
if ( on ) | ||
mFlags |= flag; | ||
else | ||
mFlags &= ~flag; | ||
} | ||
|
||
QgsLayoutContext::Flags QgsLayoutContext::flags() const | ||
{ | ||
return mFlags; | ||
} | ||
|
||
bool QgsLayoutContext::testFlag( const QgsLayoutContext::Flag flag ) const | ||
{ | ||
return mFlags.testFlag( flag ); | ||
} | ||
|
||
QgsVectorLayer *QgsLayoutContext::layer() const | ||
{ | ||
return mLayer; | ||
} | ||
|
||
void QgsLayoutContext::setLayer( QgsVectorLayer *layer ) | ||
{ | ||
mLayer = layer; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
/*************************************************************************** | ||
qgslayoutcontext.h | ||
------------------- | ||
begin : July 2017 | ||
copyright : (C) 2017 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
#ifndef QGSLAYOUTCONTEXT_H | ||
#define QGSLAYOUTCONTEXT_H | ||
|
||
#include "qgis_core.h" | ||
#include "qgsfeature.h" | ||
#include "qgsvectorlayer.h" | ||
#include <QtGlobal> | ||
|
||
class QgsFeature; | ||
class QgsVectorLayer; | ||
|
||
/** | ||
* \ingroup Layout | ||
* \class QgsLayoutContext | ||
* \brief Stores information relating to the current context and rendering settings for a layout. | ||
* \since QGIS 3.0 | ||
*/ | ||
class CORE_EXPORT QgsLayoutContext | ||
{ | ||
|
||
public: | ||
|
||
//! Flags for controlling how a layout is rendered | ||
enum Flag | ||
{ | ||
FlagDebug = 1 << 1, //!< Debug/testing mode, items are drawn as solid rectangles. | ||
FlagOutlineOnly = 1 << 2, //!< Render items as outlines only. | ||
FlagAntialiasing = 1 << 3, //!< Use antialiasing when drawing items. | ||
FlagUseAdvancedEffects = 1 << 4, //!< Enable advanced effects such as blend modes. | ||
}; | ||
Q_DECLARE_FLAGS( Flags, Flag ) | ||
|
||
QgsLayoutContext(); | ||
|
||
/** | ||
* Sets the combination of \a flags that will be used for rendering the layout. | ||
* \see setFlag() | ||
* \see flags() | ||
* \see testFlag() | ||
*/ | ||
void setFlags( const QgsLayoutContext::Flags flags ); | ||
|
||
/** | ||
* Enables or disables a particular rendering \a flag for the layout. Other existing | ||
* flags are not affected. | ||
* \see setFlags() | ||
* \see flags() | ||
* \see testFlag() | ||
*/ | ||
void setFlag( const QgsLayoutContext::Flag flag, const bool on = true ); | ||
|
||
/** | ||
* Returns the current combination of flags used for rendering the layout. | ||
* \see setFlags() | ||
* \see setFlag() | ||
* \see testFlag() | ||
*/ | ||
QgsLayoutContext::Flags flags() const; | ||
|
||
/** | ||
* Check whether a particular rendering \a flag is enabled for the layout. | ||
* \see setFlags() | ||
* \see setFlag() | ||
* \see flags() | ||
*/ | ||
bool testFlag( const Flag flag ) const; | ||
|
||
/** | ||
* Sets the current \a feature for evaluating the layout. This feature may | ||
* be used for altering an item's content and appearance for a report | ||
* or atlas layout. | ||
* \see feature() | ||
*/ | ||
void setFeature( const QgsFeature &feature ) { mFeature = feature; } | ||
|
||
/** | ||
* Returns the current feature for evaluating the layout. This feature may | ||
* be used for altering an item's content and appearance for a report | ||
* or atlas layout. | ||
* \see setFeature() | ||
*/ | ||
QgsFeature feature() const { return mFeature; } | ||
|
||
/** | ||
* Returns the vector layer associated with the layout's context. | ||
* \see setLayer() | ||
*/ | ||
QgsVectorLayer *layer() const; | ||
|
||
/** | ||
* Sets the vector \a layer associated with the layout's context. | ||
* \see layer() | ||
*/ | ||
void setLayer( QgsVectorLayer *layer ); | ||
|
||
private: | ||
|
||
Flags mFlags = 0; | ||
|
||
QgsFeature mFeature; | ||
QPointer< QgsVectorLayer > mLayer; | ||
|
||
}; | ||
|
||
#endif //QGSLAYOUTCONTEXT_H | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.