Biomedical Image Analysis Library
The Biomedical Image Analysis Library is a poweful tool for developers, physicians, researchers, engineers, and so on.
graphicsscene.cpp
Go to the documentation of this file.
1 #include "graphicsscene.h"
2 #include <QPainter>
3 
4 QPointF GraphicsScene::overlayPos( ) const {
5  return( m_overlayPos );
6 }
7 
8 GraphicsScene::GraphicsScene( QObject *parent ) : QGraphicsScene( parent ) {
9  m_overlay = false;
10  m_overlayPen = QPen( Qt::green );
11  m_overlayPos = QPointF( -1, -1 );
12 }
13 
14 void GraphicsScene::setOverlayPen( const QPen &overlayPen ) {
15  m_overlayPen = overlayPen;
16  update( );
17 }
18 
19 void GraphicsScene::setOverlayPos( QPointF pos ) {
20  m_overlayPos = pos;
21  update( );
22 }
23 
24 bool GraphicsScene::overlay( ) const {
25  return( m_overlay );
26 }
27 
29  m_overlay = overlay;
30  update( );
31 }
32 
33 void GraphicsScene::drawForeground( QPainter *painter, const QRectF &rect ) {
34  if( m_overlay ) {
35  painter->setRenderHint( QPainter::Antialiasing );
36  painter->setPen( m_overlayPen );
37  /* painter->setOpacity( 1.0 ); */
38  painter->drawLine( m_overlayPos.x( ), 0, m_overlayPos.x( ), height( ) ); /* vertical */
39  painter->drawLine( 0, m_overlayPos.y( ), width( ), m_overlayPos.y( ) ); /* horizontal */
40  }
41  QGraphicsScene::drawForeground( painter, rect );
42 }
void setOverlayPen(const QPen &overlayPen)
void drawForeground(QPainter *painter, const QRectF &rect)
void setOverlayPos(QPointF pos)
bool overlay() const
GraphicsScene(QObject *parent=0)
QPointF overlayPos() const
void setOverlay(bool overlay)