[TechDraw] Use function overloadin and avoid code repeat
This commit is contained in:
committed by
WandererFan
parent
91f84184bf
commit
8b52db90c5
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user