23 , mHidePageIfEmpty( false )
24 , mHideBackgroundIfEmpty( false )
31 connect( mf, SIGNAL( contentsChanged() ),
this, SLOT(
repaint() ) );
41 , mMultiFrame(
nullptr )
42 , mHidePageIfEmpty(
false )
43 , mHideBackgroundIfEmpty(
false )
60 frameElem.
setAttribute(
"hidePageIfEmpty", mHidePageIfEmpty );
61 frameElem.
setAttribute(
"hideBackgroundIfEmpty", mHideBackgroundIfEmpty );
73 mSection =
QRectF( x, y, width, height );
74 mHidePageIfEmpty = itemElem.
attribute(
"hidePageIfEmpty",
"0" ).
toInt();
75 mHideBackgroundIfEmpty = itemElem.
attribute(
"hideBackgroundIfEmpty",
"0" ).
toInt();
77 if ( composerItem.
isNull() )
81 return _readXML( composerItem, doc );
91 if ( hideBackgroundIfEmpty == mHideBackgroundIfEmpty )
108 if ( multiFrameHeight <= mSection.
top() )
143 return tr(
"<frame>" );
148 QRectF fixedRect = rectangle;
153 int frameIndex = mMultiFrame->
frameIndex(
this );
156 if ( fixedSize.
width() > 0 )
160 if ( fixedSize.
height() > 0 )
176 Q_UNUSED( itemStyle );
190 if ( !empty || !mHideBackgroundIfEmpty )
197 int frameIndex = mMultiFrame->
frameIndex(
this );
198 mMultiFrame->
render( painter, mSection, frameIndex );
201 if ( !empty || !mHideBackgroundIfEmpty )
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
bool shouldDrawItem() const
Returns whether the item should be drawn in the current context.
QDomNode appendChild(const QDomNode &newChild)
QString attribute(const QString &name, const QString &defValue) const
void setHideBackgroundIfEmpty(const bool hideBackgroundIfEmpty)
Sets whether the background and frame border should be hidden if this frame is empty.
virtual QString displayName() const override
Get item display name.
A item that forms part of a map composition.
virtual QgsExpressionContext * createExpressionContext() const override
Creates an expression context relating to the item's current state.
virtual QString displayName() const
Get multiframe display name.
virtual void drawFrame(QPainter *p)
Draw black frame around item.
virtual QSizeF totalSize() const =0
Returns the total size of the multiframe's content.
bool _writeXML(QDomElement &itemElem, QDomDocument &doc) const
Writes parameter that are not subclass specific in document.
double toDouble(bool *ok) const
virtual QgsExpressionContext * createExpressionContext() const override
Creates an expression context relating to the item's current state.
QString tr(const char *sourceText, const char *disambiguation, int n)
void update(const QRectF &rect)
void endMultiFrameCommand()
void setHeight(qreal height)
bool _readXML(const QDomElement &itemElem, const QDomDocument &doc)
Reads parameter that are not subclass specific in document.
bool isEmpty() const
Returns whether the frame is empty.
QString number(int n, int base)
virtual void drawSelectionBoxes(QPainter *p)
Draws additional graphics on selected items.
void setAttribute(const QString &name, const QString &value)
void endItemCommand() override
int toInt(bool *ok, int base) const
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Abstract base class for composer items with the ability to distribute the content to several frames (...
void setSceneRect(const QRectF &rectangle) override
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
void setBackgroundEnabled(const bool drawBackground)
Set whether this item has a Background drawn around it or not.
static QgsExpressionContextScope * composerItemScope(const QgsComposerItem *composerItem)
Creates a new scope which contains variables and functions relating to a QgsComposerItem.
Graphics scene for map printing.
void beginItemCommand(const QString &text) override
void setHidePageIfEmpty(const bool hidePageIfEmpty)
Sets whether the page should be hidden (ie, not included in composer exports) if this frame is empty...
QgsComposition * mComposition
virtual QSizeF minFrameSize(const int frameIndex=-1) const
Returns the minimum size for a frames, if desired.
bool hidePageIfEmpty() const
Returns whether the page should be hidden (ie, not included in composer exports) if this frame is emp...
bool hideBackgroundIfEmpty() const
Returns whether the background and frame border should be hidden if this frame is empty...
void setWidth(qreal width)
QgsComposerMultiFrame * multiFrame() const
Returns the parent multiframe for the frame.
virtual void drawBackground(QPainter *p)
Draw background.
bool writeXML(QDomElement &elem, QDomDocument &doc) const override
Stores item state in DOM element.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
QDomElement firstChildElement(const QString &tagName) const
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
QgsComposerFrame(QgsComposition *c, QgsComposerMultiFrame *mf, qreal x, qreal y, qreal width, qreal height)
virtual QSizeF fixedFrameSize(const int frameIndex=-1) const
Returns the fixed size for a frame, if desired.
virtual Q_DECL_DEPRECATED void render(QPainter *p, const QRectF &renderExtent)
Renders a portion of the multiframe's content into a painter.
int frameIndex(QgsComposerFrame *frame) const
Returns the index of a frame within the multiframe.
bool readXML(const QDomElement &itemElem, const QDomDocument &doc) override
Sets item state from DOM element.
QgsComposerItem(QgsComposition *composition, bool manageZValue=true)
Constructor.
QDomElement createElement(const QString &tagName)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString id() const
Get item's id (which is not necessarly unique)
virtual QgsExpressionContext * createExpressionContext() const
Creates an expression context relating to the objects' current state.
void beginMultiFrameCommand(QgsComposerMultiFrame *multiFrame, const QString &text, const QgsComposerMultiFrameMergeCommand::Context c=QgsComposerMultiFrameMergeCommand::Unknown)