[TechDraw] Use function overloadin and avoid code repeat

This commit is contained in:
Benjamin Bræstrup Sayoc
2022-07-06 18:01:43 +02:00
committed by WandererFan
parent 91f84184bf
commit 8b52db90c5
8 changed files with 8 additions and 23 deletions

View File

@@ -51,12 +51,7 @@ QGCustomBorder::QGCustomBorder()
void QGCustomBorder::centerAt(QPointF centerPos)
{
QRectF box = boundingRect();
double width = box.width();
double height = box.height();
double newX = centerPos.x() - width/2.;
double newY = centerPos.y() - height/2.;
setPos(newX,newY);
centerAt(centerPos.x(), centerPos.y());
}
void QGCustomBorder::centerAt(double cX, double cY)

View File

@@ -55,7 +55,7 @@ QGCustomClip::QGCustomClip()
void QGCustomClip::centerAt(QPointF centerPos)
{
centerAt(centerPos.x(),centerPos.y());
centerAt(centerPos.x(), centerPos.y());
}
void QGCustomClip::centerAt(double cX, double cY)

View File

@@ -51,7 +51,7 @@ QGCustomImage::~QGCustomImage()
void QGCustomImage::centerAt(QPointF centerPos)
{
centerAt(centerPos.x(),centerPos.y());
centerAt(centerPos.x(), centerPos.y());
}
void QGCustomImage::centerAt(double cX, double cY)

View File

@@ -55,12 +55,7 @@ QGCustomLabel::QGCustomLabel()
void QGCustomLabel::centerAt(QPointF centerPos)
{
QRectF box = boundingRect();
double width = box.width();
double height = box.height();
double newX = centerPos.x() - width/2.;
double newY = centerPos.y() - height/2.;
setPos(newX,newY);
centerAt(centerPos.x(), centerPos.y());
}
void QGCustomLabel::centerAt(double cX, double cY)

View File

@@ -51,12 +51,7 @@ QGCustomRect::QGCustomRect()
void QGCustomRect::centerAt(QPointF centerPos)
{
QRectF box = boundingRect();
double width = box.width();
double height = box.height();
double newX = centerPos.x() - width/2.;
double newY = centerPos.y() - height/2.;
setPos(newX,newY);
centerAt(centerPos.x(), centerPos.y());
}
void QGCustomRect::centerAt(double cX, double cY)

View File

@@ -51,7 +51,7 @@ QGCustomSvg::~QGCustomSvg()
void QGCustomSvg::centerAt(QPointF centerPos)
{
centerAt(centerPos.x(),centerPos.y());
centerAt(centerPos.x(), centerPos.y());
}
void QGCustomSvg::centerAt(double cX, double cY)

View File

@@ -65,7 +65,7 @@ QGCustomText::QGCustomText(QGraphicsItem* parent) :
void QGCustomText::centerAt(QPointF centerPos)
{
centerAt(centerPos.x(),centerPos.y());
centerAt(centerPos.x(), centerPos.y());
}
void QGCustomText::centerAt(double cX, double cY)

View File

@@ -52,7 +52,7 @@ QGDisplayArea::QGDisplayArea(void)
void QGDisplayArea::centerAt(QPointF centerPos)
{
centerAt(centerPos.x(),centerPos.y());
centerAt(centerPos.x(), centerPos.y());
}
void QGDisplayArea::centerAt(double cX, double cY)