22 #include <QGraphicsRectItem> 23 #include <QGraphicsView> 30 setFlag( QGraphicsItem::ItemIsSelectable,
false );
31 setFlag( QGraphicsItem::ItemIsMovable,
false );
42 Q_UNUSED( itemStyle );
72 currentYCoord = minYCoord;
81 painter->
setPen( gridPen );
83 double halfCrossLength = 1;
109 currentYCoord = minYCoord;
112 painter->
drawLine(
QPointF( currentXCoord - halfCrossLength, currentYCoord ),
QPointF( currentXCoord + halfCrossLength, currentYCoord ) );
113 painter->
drawLine(
QPointF( currentXCoord, currentYCoord - halfCrossLength ),
QPointF( currentXCoord, currentYCoord + halfCrossLength ) );
131 QgsPaperItem::QgsPaperItem( qreal
x, qreal
y, qreal width, qreal height,
QgsComposition*
composition ):
QgsComposerItem( x, y, width, height, composition, false ),
132 mPageGrid( nullptr ), mPageMargin( 0 )
138 mPageGrid(
nullptr ), mPageMargin( 0 )
150 Q_UNUSED( itemStyle );
169 delete expressionContext;
181 painter->
setPen( Qt::NoPen );
190 painter->
scale( 1 / dotsPerMM, 1 / dotsPerMM );
195 calculatePageMargin();
197 (
rect().width() - 2 * mPageMargin ) * dotsPerMM, (
rect().height() - 2 * mPageMargin ) * dotsPerMM ) );
205 void QgsPaperItem::calculatePageMargin()
225 Q_UNUSED( itemElem );
238 void QgsPaperItem::initialize()
240 setFlag( QGraphicsItem::ItemIsSelectable,
false );
241 setFlag( QGraphicsItem::ItemIsMovable,
false );
void setForceVectorOutput(bool force)
const QPen & gridPen() const
void renderPolygon(const QPolygonF &points, QList< QPolygonF > *rings, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
QgsFillSymbolV2 * pageStyleSymbol()
Note: added in version 2.1.
double snapGridOffsetY() const
bool writeXML(QDomElement &elem, QDomDocument &doc) const override
Stores state in Dom element.
double snapGridOffsetX() const
void setRenderHint(RenderHint hint, bool on)
void setFlag(GraphicsItemFlag flag, bool enabled)
void setOutputDpi(int dpi)
Set DPI used for conversion between real world units (e.g. mm) and pixels.
int printResolution() const
void scale(qreal sx, qreal sy)
const T & at(int i) const
A item that forms part of a map composition.
QgsPaperGrid(double x, double y, double width, double height, QgsComposition *composition)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
void drawLine(const QLineF &line)
QGraphicsScene * scene() const
virtual QgsExpressionContext * createExpressionContext() const override
Creates an expression context relating to the item's current state.
void setRect(const QRectF &rectangle)
QgsComposition::PlotStyle plotStyle() const
The QgsMapSettings class contains configuration for rendering of the map.
void drawRect(const QRectF &rectangle)
void startRender(QgsRenderContext &context, const QgsFields *fields=nullptr)
void setPen(const QColor &color)
void setPos(const QPointF &pos)
QList< QGraphicsView * > views() const
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
bool readXML(const QDomElement &itemElem, const QDomDocument &doc) override
Sets state from Dom document.
QPaintDevice * device() const
Item representing a grid.
void setBrush(const QBrush &brush)
void setPainter(QPainter *p)
QgsPaperItem(QgsComposition *c)
static double estimateMaxSymbolBleed(QgsSymbolV2 *symbol)
Returns the maximum estimated bleed for the symbol.
Graphics scene for map printing.
const QgsMapSettings & mapSettings() const
Return setting of QGIS map canvas.
QgsComposition * mComposition
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
Reimplementation of QCanvasItem::paint.
Contains information about the context of a rendering operation.
void stopRender(QgsRenderContext &context)
const QgsComposition * composition() const
Returns the composition the item is attached to.
void setPen(const QPen &pen)
static QgsRenderContext fromMapSettings(const QgsMapSettings &mapSettings)
create initialized QgsRenderContext instance from given QgsMapSettings
GridStyle gridStyle() 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...
virtual 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...
double snapGridResolution() const
QgsAtlasComposition & atlasComposition()
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
Reimplementation of QCanvasItem::paint.
QgsComposerItem(QgsComposition *composition, bool manageZValue=true)
Constructor.
bool pagesVisible() const
Returns whether the page items are be visible in the composition.
void addItem(QGraphicsItem *item)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setExpressionContext(const QgsExpressionContext &context)
Sets the expression context.