22 #include <QGraphicsRectItem>
29 setFlag( QGraphicsItem::ItemIsSelectable,
false );
30 setFlag( QGraphicsItem::ItemIsMovable,
false );
39 void QgsPaperGrid::paint( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
41 Q_UNUSED( itemStyle );
58 painter->setRenderHint( QPainter::Antialiasing,
false );
67 painter->drawLine( QPointF( currentXCoord, 0 ), QPointF( currentXCoord, rect().height() ) );
71 currentYCoord = minYCoord;
74 painter->drawLine( QPointF( 0, currentYCoord ), QPointF( rect().width(), currentYCoord ) );
80 painter->setPen( gridPen );
81 painter->setBrush( QBrush( gridPen.color() ) );
82 double halfCrossLength = 1;
89 QList<QGraphicsView*> viewList = scene()->views();
90 if ( viewList.size() > 0 )
92 QGraphicsView* currentView = viewList.at( 0 );
93 if ( currentView->isVisible() )
96 halfCrossLength = 1 / currentView->transform().m11();
108 currentYCoord = minYCoord;
111 painter->drawLine( QPointF( currentXCoord - halfCrossLength, currentYCoord ), QPointF( currentXCoord + halfCrossLength, currentYCoord ) );
112 painter->drawLine( QPointF( currentXCoord, currentYCoord - halfCrossLength ), QPointF( currentXCoord, currentYCoord + halfCrossLength ) );
130 QgsPaperItem::QgsPaperItem( qreal x, qreal y, qreal width, qreal height,
QgsComposition* composition ):
QgsComposerItem( x, y, width, height, composition, false ),
131 mPageGrid( 0 ), mPageMargin( 0 )
137 mPageGrid( 0 ), mPageMargin( 0 )
147 void QgsPaperItem::paint( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
149 Q_UNUSED( itemStyle );
174 painter->setRenderHint( QPainter::Antialiasing,
false );
177 painter->setBrush( QBrush( QColor( 150, 150, 150 ) ) );
178 painter->setPen( Qt::NoPen );
179 painter->drawRect( QRectF( 1, 1, rect().width() + 1, rect().height() + 1 ) );
182 painter->setBrush( QColor( 215, 215, 215 ) );
183 painter->setPen( QPen( QColor( 100, 100, 100 ) ) );
184 painter->drawRect( QRectF( 0, 0, rect().width(), rect().height() ) );
187 painter->setRenderHint( QPainter::Antialiasing );
192 QList<QPolygonF> rings;
230 Q_UNUSED( itemElem );
239 mPageGrid->setRect( 0, 0, rect().width(), rect().height() );
240 mPageGrid->setPos( pos().x(), pos().y() );
245 setFlag( QGraphicsItem::ItemIsSelectable,
false );
246 setFlag( QGraphicsItem::ItemIsMovable,
false );
252 setPen( QPen( QBrush( Qt::NoBrush ), 4 ) );