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()); }
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()); }
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(); } }
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(); }
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(); }
double QPaintWidget::scalePointX(double x){ return ((x - minX)/ (maxX - minX)) * canvasWidth() + kPadding; }