Ejemplo n.º 1
0
void SceneObject::paint(QPainter &painter, const KoViewConverter &converter,
                        KoShapePaintingContext &context)
{
    Q_UNUSED(context);

    //painter.setPen(QPen(QColor(172, 196, 206)));
    painter.setPen(QPen(QColor(0, 0, 0)));

#if 1
    painter.drawRect(converter.documentToView(QRectF(QPoint(0, 0), size())));
#else
    QRectF rect = converter.documentToView(boundingRect());
    QRectF rect = converter.documentToView(QRectF(QPoint(0, 0), size()));
    painter.drawRect(rect);
#endif
    kDebug(31000) << "boundingRect: " << boundingRect();
    kDebug(31000) << "outlineRect: " << outlineRect();

#if 0 // Taken from the vector shape
    QRectF  rect(QPointF(0,0), m_size);
    painter.save();

    // Draw a simple cross in a rectangle just to indicate that there is something here.
    painter.setPen(QPen(QColor(172, 196, 206)));
    painter.drawRect(rect);
    painter.drawLine(rect.topLeft(), rect.bottomRight());
    painter.drawLine(rect.bottomLeft(), rect.topRight());

    painter.restore();
#endif
}
Ejemplo n.º 2
0
QPainterPath SchedulePoint::shape() const
{
    // provide shape of each point
    QRectF rect = outlineRect();
    QPainterPath path;
    path.addRoundRect(rect,roundness(rect.width()), roundness(rect.height()));
    return path;
}
Ejemplo n.º 3
0
QPainterPath usecaseclass::shape() const
{
    QRectF rect = outlineRect();

    QPainterPath path;
    path.addRoundRect(rect, roundness(rect.width()),
                      roundness(rect.height()));
    return path;
}
Ejemplo n.º 4
0
/*
 * StatusWndDraw3DBox - called by StatusWndDrawLine or externally
 *                      if StatusWndDrawLine is not used.
 */
void StatusWndDraw3DBox( statwnd *sw, WPI_PRES pres )
{
    HPEN        old_pen;
    int         i;
    WPI_RECT    r;

    old_pen = _wpi_selectobject( pres, penLight );
    for( i = 0; i <= sw->numSections; i++ ) {
        getRect( sw, &r, i );
        outlineRect( sw, pres, &r );
        makeInsideRect( &r );
        _wpi_fillrect( pres, &r, colorButtonFace, brushButtonFace );
    }
    _wpi_selectobject( pres, old_pen );

} /* StatusWndDraw3DBox */
Ejemplo n.º 5
0
void usecaseclass::paint(QPainter *painter,
                 const QStyleOptionGraphicsItem *option,
                 QWidget * /* widget */)
{
    QPen pen(myOutlineColor);


    painter->setPen(pen);
    painter->setBrush(myBackgroundColor);

    QRectF rect = outlineRect();
    //QPainter painter(this);
    painter->drawEllipse(-40,-30,80,60);

    painter->setPen(myTextColor);
    painter->drawText(rect, Qt::AlignCenter, myText);
    Nnode->setPos(this->pos().x(),this->pos().y()+30);
    Wnode->setPos(this->pos().x()-40,this->pos().y());
    Enode->setPos(this->pos().x()+40,this->pos().y());
    Snode->setPos(this->pos().x(),this->pos().y()-30);

    this->scene()->addItem(Nnode);
    this->scene()->addItem(Wnode);
    this->scene()->addItem(Enode);
    this->scene()->addItem(Snode);

    if (option->state & QStyle::State_Selected)
    {
        Nnode->show();
        Wnode->show();
        Enode->show();
        Snode->show();
    }
    else
    {
        Nnode->hide();
        Wnode->hide();
        Enode->hide();
        Snode->hide();
    }
}
Ejemplo n.º 6
0
void SchedulePoint::paint(QPainter *painter,
                          const QStyleOptionGraphicsItem *option, QWidget * /*widget*/)
{
    // draw point itself

    if(option->state & QStyle::State_Selected) {

    }



    if(m_disabled)
    {
        painter->setBrush(QColor(150,150,150));
        painter->setPen(QColor(110,110,110));
    }

    else if(m_selected)
    {
        pen.setWidth(3);
        pen.setColor(QColor(255, 189, 43));
        painter->setPen(pen);
        myBackgroundColor = tempToColor(temp);
        painter->setBrush(myBackgroundColor);
    }
    else
    {
        myBackgroundColor = tempToColor(temp);
        pen.setColor(Qt::white);
        pen.setWidth(1);
        painter->setPen(pen);
        painter->setBrush(myBackgroundColor);
    }

    QRectF rect = outlineRect();
    painter->drawRoundRect(rect, roundness(rect.width()), roundness(rect.height()));
    painter->setPen(Qt::white);
    painter->drawText(rect, Qt::AlignCenter, myText);
}
Ejemplo n.º 7
0
QRectF Program::boundingRect() const
{
    //const int Margin = 1;
    return outlineRect();//.adjusted(-Margin, -Margin, +Margin, +Margin);
}
Ejemplo n.º 8
0
QRectF SchedulePoint::boundingRect() const
{
    // provide size of each point for collision detection
    const int margin = 1;
    return outlineRect().adjusted(-margin, -margin, +margin, +margin);
}
Ejemplo n.º 9
0
QRectF usecaseclass::boundingRect() const
{
    const int Margin = 1;
    return outlineRect().adjusted(-Margin, -Margin, +Margin, +Margin);
}