转换坐标 改变旋转中心
This commit is contained in:
1 parent
94c100ee65
commit
09d8e6633d
1 file changed
+3
-3
@@ -30,7 +30,7 @@ Car::Car(ParkingLotManager * manager, QGraphicsItem *parent, int dir, Car::Color
|
||||
}
|
||||
m_pic = m_pic.scaled(M_WID, M_LEN);
|
||||
this->setPixmap(m_pic);
|
||||
setTransformOriginPoint(M_WID/2, M_LEN/2); //设置旋转中心
|
||||
setTransformOriginPoint(0, M_LEN/2); //设置旋转中心
|
||||
connect(posAni,QPropertyAnimation::finished,this,followPath);
|
||||
connect(this, &Car::queueHead, manager, &ParkingLotManager::requestIn);
|
||||
connect(this, &Car::exit, manager, &ParkingLotManager::leave);
|
||||
@@ -91,7 +91,7 @@ void Car::setPath(Path *path)
|
||||
m_current = m_target;
|
||||
m_target.action = Road::none;
|
||||
this->setPos(m_target.point);
|
||||
|
||||
this->setRotation(m_target.dir+90);
|
||||
}
|
||||
|
||||
int Car::getNum()
|
||||
@@ -122,7 +122,7 @@ void Car::moveTo(QPointF target)
|
||||
|
||||
void Car::followPath()
|
||||
{
|
||||
setRotation(m_target.dir);
|
||||
setRotation(m_target.dir+90);
|
||||
switch (m_target.action)
|
||||
{
|
||||
case Road::entry :
|
||||
|
||||
Reference in new issue
Block a user