Example #1
0
void
Frame::updateLayoutGeometry()
{
    ILOG_TRACE_W(ILX_FRAME);
    ILOG_DEBUG( ILX_FRAME, " -> R(%d, %d, %d, %d)\n", canvasX(), canvasY(), canvasWidth(), canvasHeight());
    _layout->setGeometry(canvasX(), canvasY(), canvasWidth(), canvasHeight());
}
void FormEditorScene::resetScene()
{
    foreach (QGraphicsItem *item, m_manipulatorLayerItem->childItems())
       removeItem(item);

    setSceneRect(-canvasWidth()/2., -canvasHeight()/2., canvasWidth(), canvasHeight());
}
Example #3
0
FormEditorScene::FormEditorScene(FormEditorWidget *view, FormEditorView *editorView)
        : QGraphicsScene(),
        m_editorView(editorView),
        m_showBoundingRects(true)
{
    setupScene();
    view->setScene(this);
    setItemIndexMethod(QGraphicsScene::NoIndex);
    setSceneRect(-canvasWidth()/2., -canvasHeight()/2., canvasWidth(), canvasHeight());
}
Example #4
0
void QPaintWidget::drawCircle(QPainter *ppainter)
{
    if (circle.radius !=0)
    {

           ppainter->save();

           double posXCenter = scalePointX(circle.pos.x());
           double posYCenter = scalePointY(circle.pos.y());
           int sizeX = static_cast<int>(circle.radius/((maxX - minX) / canvasWidth()));
           int sizeY = static_cast<int>(circle.radius/((maxY - minY) / canvasHeight()));
           int size = kmin(sizeX, sizeY);

           ppainter->setPen(QPen(Qt::darkGreen, kDrawPenWidth));
           ppainter->setBrush(QBrush(Qt::transparent));
           ppainter->drawEllipse(
                                 posXCenter-size,
                                 posYCenter-size,
                                 2*size+1,
                                 2*size+1
                                 );

           ppainter->restore();
    }
}
Example #5
0
void QPaintWidget::drawFrame(QPainter *ppainter){

    QVector<QPointF> linePoints;
    linePoints <<  QPointF(kPadding,kPadding)
                <<  QPointF(kPadding,canvasHeight()+kPadding)
                 <<  QPointF(kPadding,canvasHeight()+kPadding)
                  <<  QPointF(canvasWidth()+kPadding,canvasHeight()+kPadding)
                   <<  QPointF(canvasWidth()+kPadding,canvasHeight()+kPadding)
                    <<  QPointF(canvasWidth()+kPadding,kPadding)
                     <<  QPointF(canvasWidth()+kPadding,kPadding)
                      <<  QPointF(kPadding,kPadding);

    ppainter->save();

    ppainter->setPen(QPen(Qt::lightGray,1,Qt::DashLine));
    ppainter->drawLines( linePoints );

    ppainter->restore();


}
Example #6
0
void QPaintWidget::drawAxis(QPainter *ppainter)
{
    double w = canvasWidth()+kPadding;
    double h = canvasHeight()+kPadding;
    double step = 92;

    ppainter->save();
    ppainter->setPen(QPen(Qt::lightGray,1,Qt::DashLine));
    for (double x = kPadding; x <= w; x += step)
    {
        ppainter->drawLine(QPointF(x,h), QPointF(x,kPadding));
     }
    for (double y = kPadding; y <= h; y += step)
    {
        ppainter->drawLine(QPointF(kPadding,y), QPointF(w,y));
    }
    ppainter->restore();

}
Example #7
0
double QPaintWidget::scalePointX(double x){
    return  ((x - minX)/ (maxX - minX)) * canvasWidth() + kPadding;
}