Exemple #1
0
void line:: paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){
    if(mPaintFlag){
        QPen paintpen(Qt::red);
        paintpen.setWidth(4);

        QPen linepen(Qt::black);
        linepen.setWidth(1);

        QPoint p1;
        p1.setX(x1);
        p1.setY(y1);

        painter->setPen(paintpen);
        painter->drawPoint(p1);

        QPoint p2;
        p2.setX(x2);
        p2.setY(y2);

        painter->setPen(paintpen);
        painter->drawPoint(p2);

        painter->setPen(linepen);
        painter->drawLine(p1, p2);
    }
}
Exemple #2
0
void GraphScene::drawBackground ( QPainter * painter, const QRectF & rect ) {
	//clear the background in dark grey
	
	
	painter->setRenderHints(QPainter::Antialiasing);
	painter->save();
		QBrush bg(QColor(20,20,20));
		painter->setBrush(bg);
		painter->drawRect(rect);
	painter->restore();
	
	painter->save();
		QPen linepen(QColor(200,200,200), 1, Qt::SolidLine);
		linepen.setCosmetic(true);
		painter->setPen(linepen);
		painter->drawLine(control->getFullRange()->getMin(),0,control->getFullRange()->getMax(),0);
	painter->restore();
	//draw slightly visible second time-marks depending on range
	
	//draw textual time-labels also depending on range
	
	
	
	
}
Exemple #3
0
void ellipse:: paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){
    QRectF rect = boundingRect();
        QPen pen(Qt::black, 1);
    if(mPaintFlag){

        QPen paintpen(Qt::red);
        paintpen.setWidth(1);

        QPen linepen(Qt::black);
        linepen.setWidth(1);

        QPoint p1;
        p1.setX(x1);
        p1.setY(y1);

        painter->setPen(paintpen);
        painter->drawPoint(p1);

        QPoint p2;
        p2.setX(x2);
        p2.setY(y2);

        painter->setPen(paintpen);
        painter->drawPoint(p2);

        painter->setPen(linepen);
        int x = 0 * 16;
        int y = 360 * 16;
        painter->drawArc(x1,y1,x2,y2,x,y);
    }

}
VLCStatsView::VLCStatsView( QWidget *parent ) : QGraphicsView( parent )
{
    QColor history(0, 0, 0, 255),
        total(237, 109, 0, 160),
        content(109, 237, 0, 160);

    scale( 1.0, -1.0 ); /* invert our Y axis */
    setOptimizationFlags( QGraphicsView::DontAdjustForAntialiasing );
    setAlignment( Qt::AlignLeft );
    setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    viewScene = new QGraphicsScene( this );
    historyShape = viewScene->addPolygon( QPolygonF(), QPen(Qt::NoPen),
                                             QBrush(history) );
    totalbitrateShape = viewScene->addPolygon( QPolygonF(), QPen(Qt::NoPen),
                                           QBrush(total) );
    setScene( viewScene );
    reset();

    QPen linepen( Qt::DotLine );
    linepen.setCosmetic( true );
    linepen.setBrush( QBrush( QColor( 33, 33, 33 ) ) );
    for ( int i=0; i<3; i++ )
        rulers[i] = viewScene->addLine( QLineF(), linepen );
}
Exemple #5
0
void circle:: paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){
    setCursor(Qt::CrossCursor);
    if(mPaintFlag){
        QPen paintpen(Qt::red);
        paintpen.setWidth(4);

        QPen linepen(Qt::black);
        linepen.setWidth(1);

        QPoint p1;
        p1.setX(x1);
        p1.setY(y1);

        painter->setPen(paintpen);
        painter->drawPoint(p1);

        QPoint p2;
        p2.setX(move_p.x());
        p2.setY(move_p.y());

        radius = qSqrt(qPow((p2.x()-x1), 2) + qPow((p2.y()-y1), 2));

        painter->setPen(paintpen);
        painter->drawPoint(p2);

        painter->setPen(linepen);
        painter->drawEllipse(p1,radius,radius);
    }
}
Exemple #6
0
void ellipse:: paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget){
    QRectF rect = boundingRect();
    if(mPaintFlag){

        QPen paintpen(Qt::red);
        paintpen.setWidth(4);

        QPen linepen(Qt::black);
        linepen.setWidth(1);

        QPoint p1;
        p1.setX(x1);
        p1.setY(y1);

        painter->setPen(paintpen);
        painter->drawPoint(p1);

        QPoint p2;
        p2.setX(x2);
        p2.setY(y2);

        painter->setPen(paintpen);
        painter->drawPoint(p2);

        QPoint p3;
        p3.setX(x3);
        p3.setY(y3);

        painter->setPen(paintpen);
        painter->drawPoint(p3);

        majRadius = qSqrt(qPow((x2-x1), 2) + qPow((y2-y1), 2));
        minRadius = qSqrt(qPow((x3-x1), 2) + qPow((y3-y1), 2));

        painter->setPen(linepen);
        painter->drawEllipse(p1, majRadius, minRadius);
    }
}