コード例 #1
0
ファイル: Shape2D.cpp プロジェクト: trnielsen/mantid
void Shape2DEllipse::setDouble(const QString& prop, double value)
{
  if (prop == "radius1")
  {
    if (value <= 0.0) value = 1.0;
    double d = value - m_boundingRect.width() / 2;
    adjustBoundingRect(-d,0,d,0);
  }
  else if (prop == "radius2")
  {
    if (value <= 0.0) value = 1.0;
    double d = value - m_boundingRect.height() / 2;
    adjustBoundingRect(0,-d,0,d);
  }
}
コード例 #2
0
QRectF UBAbstractGraphicsPathItem::boundingRect() const
{
    QRectF rect = path().boundingRect();

    rect = adjustBoundingRect(rect);

    return rect;
}
コード例 #3
0
QRectF UBEditableGraphicsRegularShapeItem::boundingRect() const
{
    QRectF retour = adjustBoundingRect(path().boundingRect());

    if(mMultiClickState >= 1) {
        //add the size of the circle
        QPainterPath circle;
        circle.addEllipse(mCenter, mRadius, mRadius);

        qreal r = mHandles.at(0)->radius();

        retour = circle.boundingRect();
        retour = adjustBoundingRect(retour);
        retour.adjust(0, 0, r, r);
    }

    return retour;
}
コード例 #4
0
QRectF UB1HEditableGraphicsSquareItem::boundingRect() const
{
    int x = wIsNeg ? -mSide : 0;
    int y = hIsNeg ? -mSide : 0;

    QRectF rect(x, y, mSide, mSide);

    rect = adjustBoundingRect(rect);

    if(isInEditMode()){
        qreal r = mHandles.at(0)->radius();
        rect.adjust(-r, -r, r, r);
    }

    return rect;
}
コード例 #5
0
QRectF UB1HEditableGraphicsCircleItem::boundingRect() const
{
    int x = wIsNeg ? -mRadius : 0;
    int y = hIsNeg ? -mRadius : 0;

    x *= 2;
    y *= 2;

    QRectF rect(QRect(x, y, mRadius*2, mRadius*2));

    rect = adjustBoundingRect(rect);

    if(mMultiClickState >= 1){
        qreal r = getHandle()->radius();

        rect.adjust(-r, -r, r, r);
    }

    return rect;
}