void GraphicsContext::strokePath()
{
    if (paintingDisabled())
        return;

    QPainter *p = m_data->p();
    QPen pen = p->pen();
    QPainterPath path = m_data->currentPath;

    switch (m_common->state.strokeColorSpace) {
    case SolidColorSpace:
        if (strokeColor().alpha())
            p->strokePath(path, pen);
        break;
    case PatternColorSpace: {
        TransformationMatrix affine;
        pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine)));
        p->setPen(pen);
        p->strokePath(path, pen);
        break;
    }
    case GradientColorSpace: {
        QGradient* gradient = m_common->state.strokeGradient->platformGradient();
        *gradient = applySpreadMethod(*gradient, spreadMethod()); 
        pen.setBrush(QBrush(*gradient));
        p->setPen(pen);
        p->strokePath(path, pen);
        break;
    }
    }
    m_data->currentPath = QPainterPath();
}
Example #2
0
File: boid.cpp Project: ngm/qboids
void Boid::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
		 QWidget *widget)
{
	Q_UNUSED( option ); Q_UNUSED( widget );
	painter->setRenderHints( QPainter::Antialiasing );

	QPen pen;
	
	int baseHue = msSinceStart_ % 359;
	int trailLength = trail_.size()-1;

	for ( int pointIndex = 0; pointIndex < trailLength; pointIndex++ )
	{
		if ( trail_.at(pointIndex+1).isNull() ) {
			continue;
		}

		int value;
		int saturation;

		// The 'head' of the trail.
 		if ( pointIndex < 50 ) 
		{
			pen.setWidthF( sin( pointIndex ) + 2 );
			saturation = 255 - ( pow( sin( 50*static_cast<float>(NUM_TRAIL_POINTS-pointIndex) ), 2 ) * 200);
			value = (static_cast<float>(NUM_TRAIL_POINTS-pointIndex)/NUM_TRAIL_POINTS)*255;
			pen.setBrush( QColor::fromHsv( std::min( baseHue+7*id_, 359 ), saturation, value ) );
			painter->setPen( pen );
			painter->drawLine( mapFromScene( trail_[pointIndex] ), mapFromScene( trail_[pointIndex+1] ) );

		} else if ( pointIndex >= 50 && tailOn_ ) // The rest of the trail.
		{
			pen.setWidth( 1 );
			value = (static_cast<float>(NUM_TRAIL_POINTS-pointIndex)/NUM_TRAIL_POINTS)*150;
			saturation = value;
			pen.setBrush( QColor::fromHsv( std::min( baseHue+7*id_, 359 ), saturation, value ) );
			painter->setPen( pen );
			painter->drawLine( mapFromScene( trail_[pointIndex] ), mapFromScene( trail_[pointIndex+1] ) );

		}

//  		if ( pointIndex > ( NUM_TRAIL_POINTS-150 ) ) {
// 			pen.setWidthF( ( float( (pointIndex-(NUM_TRAIL_POINTS-150)) )/NUM_TRAIL_POINTS ) *160 );
//  		}



	}

	pen.setWidth( 1 );
	pen.setBrush( Qt::yellow );
	pen.setColor( Qt::yellow );
	painter->setPen( pen );
	painter->drawEllipse( -2, -2, 4, 4 );
}
void MyPainterWidget::paintEvent(QPaintEvent *event)
{
    QPen pen;
    QVector<qreal> dashes;
    qreal space = 3;

    QWidget::paintEvent(event);
    if (m_image.isNull())
        return;
    ImageAction ia;
    QImage img = ia.GetImageZoom(m_image,action_type==Zoom?zoom:0,this->width(),this->height(),o_x,o_y);
    main_window->status_value->setText(QString("%1%").arg(ia.nowZoom));
    QPainter painter(this);
    img_rect = ia.rect;
    main_window->status_size_now->setText(QString("Now:%1x%2").arg(ia.rect.width()).arg(ia.rect.height()));
    painter.drawImage(ia.rect,img);
    percentage = (float)m_image.width()/img_rect.width();
    switch(action_type){
    case Cut:
    case Copy:
    case Delete:
        if(rect.isEmpty())break;
        pen.setBrush(QBrush(qRgb(100,100,100)));
        dashes << 5 << space << 5 <<space;
        pen.setDashPattern(dashes);
        pen.setWidth(1);
        painter.setPen(pen);
        painter.drawRect(rect);
        break;
    default:

        break;
    }
    main_window->status_size->setText(QString("%1x%2").arg(m_image.width()).arg(m_image.height()));
}
Example #4
0
QImage* createNumber(int i,int r,int g,int b,int a)
{
    QImage* img = new QImage(32,32,QImage::Format_ARGB32);
    QPainter *p = new QPainter();
    QBrush br;
    p->begin(img);
    QColor black(0,0,0,0);
    for (int i=0;i<img->width();i++)
        for (int j=0;j<img->height();j++)
        {
            img->setPixel(i,j,black.rgba());
        }
    QColor txtcolor(r,g,b,a);
    QPen pen;
    pen.setStyle(Qt::SolidLine);
    pen.setWidth(3);
    pen.setBrush(txtcolor);
    pen.setCapStyle(Qt::RoundCap);
    pen.setJoinStyle(Qt::RoundJoin);
    p->setPen(pen);
    QFont f;
    f.setBold(true);
    f.setPointSize(26);
    p->setFont(f);
    p->drawText(img->width()/2-15,img->height()/2-15,30,30,Qt::AlignCenter,QString("%1").arg(i));
    p->end();
    delete p;
    return img;
}
void KnotRendererBatch::PaintInterfaceData::set(int fillColour, int outlineColour, int outlineWidth, const QList< QColor > colorList)
{
    QPen pen = p->pen();
    pen.setWidth(outlineWidth);
    if (outlineColour != -1)
        pen.setColor(colorList[outlineColour]);
    else
    {
        QBrush brush = pen.brush();
        brush.setStyle(Qt::NoBrush);
        pen.setBrush(brush);
    }
    p->setPen(pen);
    
    QBrush brush = p->brush();
    if (fillColour == -1)
    {
        brush.setStyle(Qt::NoBrush);
    }
    else
    {
        brush.setStyle(Qt::SolidPattern);
        brush.setColor(colorList[fillColour]);
    }
    p->setBrush(brush);
}
Example #6
0
void VariableEditor::paintEvent(QPaintEvent* event)
{
  QWidget::paintEvent(event);

  // draw highlighting rect like in plasma
  if (underMouse()) {
    QPainter painter(this);

    painter.setRenderHint(QPainter::Antialiasing);

    QColor cornerColor = palette().color(QPalette::Highlight);
    cornerColor.setAlphaF(0.2);

    QColor midColor = palette().color(QPalette::Highlight);
    midColor.setAlphaF(0.5);

    QRect highlightRect = rect().adjusted(2, 2, -2, -2);

    QPen outlinePen;
    outlinePen.setWidth(2);

    QLinearGradient gradient(highlightRect.topLeft(), highlightRect.topRight());
    gradient.setColorAt(0, cornerColor);
    gradient.setColorAt(0.3, midColor);
    gradient.setColorAt(1, cornerColor);
    outlinePen.setBrush(gradient);
    painter.setPen(outlinePen);

    const int radius = 5;
    painter.drawRoundedRect(highlightRect, radius, radius);
  }
}
void Context2D::setupPainter()
{
    m_painter.setRenderHint(QPainter::Antialiasing, true);
    if ((m_state.flags & DirtyClippingRegion) && !m_state.clipPath.isEmpty())
        m_painter.setClipPath(m_state.clipPath);
    if (m_state.flags & DirtyFillStyle)
        m_painter.setBrush(m_state.fillStyle);
    if (m_state.flags & DirtyGlobalAlpha)
        m_painter.setOpacity(m_state.globalAlpha);
    if (m_state.flags & DirtyGlobalCompositeOperation)
        m_painter.setCompositionMode(m_state.globalCompositeOperation);
    if (m_state.flags & MDirtyPen) {
        QPen pen = m_painter.pen();
        if (m_state.flags & DirtyStrokeStyle)
            pen.setBrush(m_state.strokeStyle);
        if (m_state.flags & DirtyLineWidth)
            pen.setWidthF(m_state.lineWidth);
        if (m_state.flags & DirtyLineCap)
            pen.setCapStyle(m_state.lineCap);
        if (m_state.flags & DirtyLineJoin)
            pen.setJoinStyle(m_state.lineJoin);
        if (m_state.flags & DirtyMiterLimit)
            pen.setMiterLimit(m_state.miterLimit);
        m_painter.setPen(pen);
    }
}
Example #8
0
int Pen::setBrush(lua_State * L) // ( const QBrush & )
{
    QPen* obj = QtValue<QPen>::check( L, 1 );
    QBrush* b = QtValue<QBrush>::check( L, 2 );
    obj->setBrush( *b );
    return 0;
}
Example #9
0
    QPixmap drawDigits(int n, const QRect &rect) {

        int scaleFactor = 2;

        QString str = QString::number(n);
        if (str.length() == 1)
            str.prepend("0");

        QFont font;
        font.setFamily("Helvetica");
        int fontHeight = scaleFactor * 0.55 * rect.height();
        font.setPixelSize(fontHeight);
        font.setBold(true);

        QPixmap pixmap(rect.size() * scaleFactor);
        pixmap.fill(Qt::transparent);

        QLinearGradient gradient(QPoint(0, 0), QPoint(0, pixmap.height()));
        gradient.setColorAt(0.00, QColor(128, 128, 128));
        gradient.setColorAt(0.49, QColor(64, 64, 64));
        gradient.setColorAt(0.51, QColor(128, 128, 128));
        gradient.setColorAt(1.00, QColor(16, 16, 16));

        QPainter p;
        p.begin(&pixmap);
        p.setFont(font);
        QPen pen;
        pen.setBrush(QBrush(gradient));
        p.setPen(pen);
        p.drawText(pixmap.rect(), Qt::AlignCenter, str);
        p.end();

        return pixmap.scaledToWidth(width(), Qt::SmoothTransformation);
    }
Example #10
0
void DiveProfileItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
	Q_UNUSED(widget);
	if (polygon().isEmpty())
		return;

	// This paints the Polygon + Background. I'm setting the pen to QPen() so we don't get a black line here,
	// after all we need to plot the correct velocities colors later.
	setPen(Qt::NoPen);
	QGraphicsPolygonItem::paint(painter, option, widget);

	// Here we actually paint the boundaries of the Polygon using the colors that the model provides.
	// Those are the speed colors of the dives.
	QPen pen;
	pen.setCosmetic(true);
	pen.setWidth(2);
	QPolygonF poly = polygon();
	// This paints the colors of the velocities.
	for (int i = 1, count = dataModel->rowCount(); i < count; i++) {
		QModelIndex colorIndex = dataModel->index(i, DivePlotDataModel::COLOR);
		pen.setBrush(QBrush(colorIndex.data(Qt::BackgroundRole).value<QColor>()));
		painter->setPen(pen);
		painter->drawLine(poly[i - 1], poly[i]);
	}
}
void paintAreas( AbstractDiagram::Private* diagramPrivate, PaintContext* ctx, const QModelIndex& index,
                 const QList< QPolygonF >& areas, uint opacity )
{
    AbstractDiagram* diagram = diagramPrivate->diagram;
    QPainterPath path;
    for ( int i = 0; i < areas.count(); ++i )
    {
        const QPolygonF& p = areas[ i ];
        path.addPolygon( p );
        diagramPrivate->reverseMapper.addPolygon( index.row(), index.column(), p );
        path.closeSubpath();
    }

    ThreeDLineAttributes threeDAttrs = threeDLineAttributes( diagram, index );
    QBrush trans = diagram->brush( index );
    if ( threeDAttrs.isEnabled() ) {
        trans = threeDAttrs.threeDBrush( trans, path.boundingRect() );
    }
    QColor transColor = trans.color();
    transColor.setAlpha( opacity );
    trans.setColor(transColor);
    QPen indexPen = diagram->pen(index);
    indexPen.setBrush( trans );
    const PainterSaver painterSaver( ctx->painter() );

    ctx->painter()->setRenderHint( QPainter::Antialiasing, diagram->antiAliasing() );
    ctx->painter()->setPen( PrintingParameters::scalePen( indexPen ) );
    ctx->painter()->setBrush( trans );

    ctx->painter()->drawPath( path );
}
Example #12
0
MagicMenuItem::MagicMenuItem()
{
  int itemSize = 55;

  setRect( -itemSize/2, -itemSize/2, itemSize, itemSize );
  setBrush( QColor( 230,229,229 ) );

  QPen pen;
  pen.setBrush( Qt::NoBrush );
  setPen( pen );

  QGraphicsTextItem *textItem = new QGraphicsTextItem( i18n("Magic"), this );

  int textWidth = textItem->boundingRect().width();
  int textHeight = textItem->boundingRect().height();

  textItem->setPos( - textWidth / 2, - textHeight / 2 );

  m_fanMenu = new FanMenu( this );
  m_fanMenu->setZValue( 50 );
  m_fanMenu->hide();
  m_fanMenu->setStartAngle( 80 );
  m_fanMenu->setEndAngle( 280 );

  FanMenuItem *menuItem = m_fanMenu->addItem( i18n("Reset\nlayout") );
  connect( menuItem, SIGNAL( clicked() ), SIGNAL( resetLayout() ) );
  menuItem = m_fanMenu->addItem( i18n("Settings") );
  connect( menuItem, SIGNAL( clicked() ), SIGNAL( showSettings() ) );

  m_fanMenu->setupItems( 80 );

  setAcceptHoverEvents( true );
}
void DateTimeGrid::paintMonthGrid( QPainter* painter,
                                  const QRectF& /*sceneRect*/,
                                  const QRectF& exposedRect,
                                  AbstractRowController* /*rowController*/,
                                  QWidget* widget )
{
    //qDebug()<<"paintMonthGrid()"<<scale()<<dayWidth();
    QDateTime dt = d->chartXtoDateTime( exposedRect.left() );
    dt.setTime( QTime( 0, 0, 0, 0 ) );
    dt = dt.addDays( 1 - dt.date().day() );
    for ( qreal x = d->dateTimeToChartX( dt ); x < exposedRect.right(); dt = dt.addDays( 1 ),x=d->dateTimeToChartX( dt ) ) {
        QPen pen = painter->pen();
        pen.setBrush( QApplication::palette().dark() );
        if ( dt.date().addMonths( 1 ).month() == 1 && dt.date().addDays( 1 ).day() == 1 ) {
            pen.setStyle( Qt::SolidLine );
        } else if ( dt.date().addDays( 1 ).day() == 1 ) {
            pen.setStyle( Qt::DashLine );
        } else {
            pen.setStyle( Qt::NoPen );
        }
        painter->setPen( pen );
        paintFreeDay( painter, x, exposedRect, dt.date(), widget );
        if ( pen.style() != Qt::NoPen ) {
            //qDebug()<<"paintMonthGrid()"<<dt;
            x += dayWidth() - 1;
            painter->drawLine( QPointF( x, exposedRect.top() ), QPointF( x, exposedRect.bottom() ) );
        }
    }
}
Example #14
0
TrailLineItem::TrailLineItem(internals::PointLatLng const& coord1,internals::PointLatLng const& coord2, QBrush color, MapGraphicItem * map):QGraphicsLineItem(map),coord1(coord1),coord2(coord2),m_brush(color),m_map(map)
    {
        QPen pen;
        pen.setBrush(m_brush);
        pen.setWidth(1);
        this->setPen(pen);
    }
DiveHeartrateItem::DiveHeartrateItem()
{
	QPen pen;
	pen.setBrush(QBrush(getColor(::HR_PLOT)));
	pen.setCosmetic(true);
	pen.setWidth(1);
	setPen(pen);
}
Example #16
0
DiveTemperatureItem::DiveTemperatureItem()
{
	QPen pen;
	pen.setBrush(QBrush(getColor(::TEMP_PLOT)));
	pen.setCosmetic(true);
	pen.setWidth(2);
	setPen(pen);
}
Example #17
0
void AuthWidget::paintExtFace(QPainter *painter,
     const QStyleOptionGraphicsItem *op, QWidget *)
{
    QRect bannerRect(op->exposedRect.x(),
         op->exposedRect.y(),
         op->exposedRect.width(),
         36);
    painter->fillRect(op->exposedRect, QColor(255, 255, 255));
    painter->fillRect(bannerRect, QColor(109, 132, 180));
    /* Painter settings */
    painter->setRenderHint(QPainter::Antialiasing, true);
    painter->setRenderHint(QPainter::TextAntialiasing, true);
    painter->setRenderHint(QPainter::HighQualityAntialiasing, true);

    /* progress bar */
    QRadialGradient gradient(50, 50, 50, 50, 50);
    gradient.setColorAt(0, QColor::fromRgbF(0, 1, 0, 1));
    gradient.setColorAt(1, QColor::fromRgbF(0, 0, 1, 1));
    const QBrush brush(gradient);
    QPen pen;
    pen.setStyle(Qt::SolidLine);
    pen.setWidth(4);
    pen.setBrush(QColor(157, 172, 241));
    pen.setCapStyle(Qt::RoundCap);
    pen.setJoinStyle(Qt::RoundJoin);

    int pfWidth = boundingRect().width() - 60;
    int pfHeight = 20;
    QRect progressFrame (boundingRect().x() + 10,
         38, mProgressValue * 2, pfHeight);
    painter->setPen(pen);
    QPoint start (progressFrame.x() + 2, progressFrame.y() + 10);
    QPoint end ((mProgressValue * 2) + 2, progressFrame.y() + 10);

    /* Facebook Text */
    if (not mLoggedIn) {
        QPoint start (progressFrame.x() + 2, progressFrame.y() + 10);
        QPoint end ((mProgressValue * 2) + 2, progressFrame.y() + 10);
        painter->drawLine(start, end);
        pen.setBrush(QColor(255, 255, 255));
        painter->setPen(pen);
        QRect txtFrame(progressFrame.x(), 10, op->exposedRect.width(), 40);
        painter->drawText(txtFrame,
             QString("Loading Facebook : %1%").arg(mProgressValue));
    }
}
/*!
    Show the snap line. fade-in animation is started on the line if the line is positioned at a different place.
    Before starting the fade-in animation, the fade-out animation is stoped if it is running.
*/
void HsSnapLine::showLine(const QLineF &snapLine)
{
    QLineF displayLine = snapLine;
    qreal angle = displayLine.angle();
    if (qAbs(angle) == 0.0 || qAbs(angle) == 180.0) { //this is a horizontal line
        //adding 1 is required below, as the line is 3 pixels wide and is translated by 1 point before displaying
        if (displayLine.y1() != (line().y1()+1.0) ) { //this horizontal line is at new position horizontally
            if (isFadeOutAnimationRunning()) { //if fade-out animation is running, stop it, animation is running at old position
                stopFadeOutAnimation();
            }
            //start fade-in animation at new position.
            startFadeInAnimation();
        }
        else { //this horizontal line is at the old position horizontally
            if (isFadeOutAnimationRunning()) { //if fade-out animation is running, stop it, animation is running at old position
                stopFadeOutAnimation();
                //start fade-in animation at the old position
                startFadeInAnimation();
            }
        }
        displayLine.translate(0.0, -1.0);
    }
    if (qAbs(angle) == 90.0 || qAbs(angle) == 270.0) { //this is a vertical line
        if (displayLine.x1() != (line().x1()+1)) { //this Vertical line is at different position vertically
            if (isFadeOutAnimationRunning()) {
                stopFadeOutAnimation();
            }
            startFadeInAnimation();
        }
        else {
            if (isFadeOutAnimationRunning()) {
                stopFadeOutAnimation();
                startFadeInAnimation();
            }
        }
        displayLine.translate(-1.0, 0.0);
    }

    QLinearGradient gradient(displayLine.p1(), displayLine.p2());
    gradient.setColorAt(0.0, Qt::white);
    QColor snapLineColor = HbColorScheme::color("qtc_hs_snapguide");
    if (!snapLineColor.isValid()) {
        //if valid color is not loaded from the theme, the darkCyan color is used as a backup.color
        snapLineColor = Qt::darkCyan;
    }
    gradient.setColorAt(0.4, snapLineColor);
    gradient.setColorAt(0.6, snapLineColor);
    gradient.setColorAt(1.0, Qt::white);
    QBrush brush(gradient);
    QPen pen;
    pen.setWidth(3);
    pen.setCapStyle(Qt::RoundCap);
    pen.setBrush(brush);
    setPen(pen);

    setLine(displayLine);
    show();
}
Example #19
0
DiveAmbPressureItem::DiveAmbPressureItem()
{
	QPen pen;
	pen.setBrush(QBrush(getColor(::AMB_PRESSURE_LINE)));
	pen.setCosmetic(true);
	pen.setWidth(2);
	setPen(pen);
	settingsChanged();
}
Example #20
0
DiveHeartrateItem::DiveHeartrateItem()
{
	QPen pen;
	pen.setBrush(QBrush(getColor(::HR_PLOT)));
	pen.setCosmetic(true);
	pen.setWidth(1);
	setPen(pen);
	connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::hrgraphChanged, this, &DiveHeartrateItem::setVisible);
}
Example #21
0
DiveMeanDepthItem::DiveMeanDepthItem()
{
	QPen pen;
	pen.setBrush(QBrush(getColor(::HR_AXIS)));
	pen.setCosmetic(true);
	pen.setWidth(2);
	setPen(pen);
	settingsChanged();
}
Example #22
0
void KoShapeStroke::fillStyle(KoGenStyle &style, KoShapeSavingContext &context) const
{
    QPen pen = d->pen;
    if (d->brush.gradient())
        pen.setBrush(d->brush);
    else
        pen.setColor(d->color);
    KoOdfGraphicStyles::saveOdfStrokeStyle(style, context.mainStyles(), pen);
}
Example #23
0
DiveHeartrateItem::DiveHeartrateItem()
{
	QPen pen;
	pen.setBrush(QBrush(getColor(::HR_PLOT)));
	pen.setCosmetic(true);
	pen.setWidth(1);
	setPen(pen);
	connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::hrgraphChanged, this, &DiveHeartrateItem::setVisible);
}
Example #24
0
DiveGFLineItem::DiveGFLineItem()
{
	QPen pen;
	pen.setBrush(QBrush(getColor(::GF_LINE)));
	pen.setCosmetic(true);
	pen.setWidth(2);
	setPen(pen);
	settingsChanged();
}
Example #25
0
void Context2D::beginPainting()
{
    if (!m_painter.isActive()) {
        m_painter.begin(&m_image);
        m_painter.setRenderHint(QPainter::Antialiasing);
        if (!m_state.clipPath.isEmpty())
            m_painter.setClipPath(m_state.clipPath);
        m_painter.setBrush(m_state.fillStyle);
        m_painter.setOpacity(m_state.globalAlpha);
        QPen pen;
        pen.setBrush(m_state.strokeStyle);
        if (pen.style() == Qt::NoPen)
            pen.setStyle(Qt::SolidLine);
        pen.setCapStyle(m_state.lineCap);
        pen.setJoinStyle(m_state.lineJoin);
        pen.setWidthF(m_state.lineWidth);
        pen.setMiterLimit(m_state.miterLimit);
        m_painter.setPen(pen);
    } else {
        if ((m_state.flags & DirtyClippingRegion) && !m_state.clipPath.isEmpty())
            m_painter.setClipPath(m_state.clipPath);
        if (m_state.flags & DirtyFillStyle)
            m_painter.setBrush(m_state.fillStyle);
        if (m_state.flags & DirtyGlobalAlpha)
            m_painter.setOpacity(m_state.globalAlpha);
        if (m_state.flags & DirtyGlobalCompositeOperation)
            m_painter.setCompositionMode(m_state.globalCompositeOperation);
        if (m_state.flags & MDirtyPen) {
            QPen pen = m_painter.pen();
            if (m_state.flags & DirtyStrokeStyle)
                pen.setBrush(m_state.strokeStyle);
            if (m_state.flags & DirtyLineWidth)
                pen.setWidthF(m_state.lineWidth);
            if (m_state.flags & DirtyLineCap)
                pen.setCapStyle(m_state.lineCap);
            if (m_state.flags & DirtyLineJoin)
                pen.setJoinStyle(m_state.lineJoin);
            if (m_state.flags & DirtyMiterLimit)
                pen.setMiterLimit(m_state.miterLimit);
            m_painter.setPen(pen);
        }
        m_state.flags = 0;
    }
}
Example #26
0
QwtPlotCurve* ActiveRouteListItem::curve() const
{
    if (Curve != 0)
    {
        QPen pen;
        pen.setBrush(textColor());
        Curve->setPen(pen);
    }
    return Curve;
}
Example #27
0
void TodoHandleItem::init()
{
  setItemSize( 30 );

  setBrush( Qt::white );

  QPen pen;
  pen.setBrush( Qt::NoBrush );
  setPen( pen );
}
Example #28
0
void ChartBase::draw_grid(QPainter& painter) const
{
    QPen pen;
    pen.setBrush(m_grid_brush);
    pen.setWidthF(1.0);
    painter.setPen(pen);

    draw_horizontal_grid(painter);
    draw_vertical_grid(painter);
}
Example #29
0
QGraphicsPathItem* ActiveRouteListItem::path() const
{
    if (Path != 0)
    {
        QPen pen;
        pen.setBrush(this->textColor());
        Path->setPen(pen);
    }
    return Path;
}
Example #30
0
void core::DotMatrix::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
	GraphicObject::paint(painter, option, widget);

	QRectF container = getContainerRect();

	painter->save();

	QPen pen;
	pen.setWidth(1);
	pen.setBrush(Qt::black);
	painter->setPen(pen);
    painter->setBrush(Qt::white);

	for(int i = 0; i < rows; i++){
		painter->drawLine(QPointF(container.x(), size * (i+1)), QPointF(container.x() + container.width(), size * (i+1)));
	}
	for(int j = 0; j < cols; j++){
		painter->drawLine(QPointF(size * (j+1), container.y()), QPointF(size * (j+1), container.y() + container.height()));
	}

	int
			sInputs = getInputsSize(),
			nDotList = (int) ptsList->size(),
			nDots = rows * cols;

	double row = 0;

	painter->save();
	for(int k = 0; k < nDots; k++){
		if(k < sInputs){
			if(k < nDotList){
				painter->setBrush(Qt::black);
				painter->drawRect(ptsList->operator [](k).col * size, ptsList->operator [](k).row * size, size, size);
			}
		}else{
			painter->setBrush(Qt::red);
			modf(k / cols, &row);
			painter->drawRect((k - (cols * row)) * size, row * size, size, size);
		}
	}

	if(enableEdit &&
	   (option->state & QStyle::State_MouseOver) &&
	   isValidDot(mouseRect))
	{
		painter->save();
		painter->setBrush(Qt::green);
		painter->drawRect(mouseRect);
		painter->restore();
	}
	painter->restore();
	painter->restore();

}