Skip to content

Commit 70c1d4b

Browse files
authored
Merge pull request #1124 from IKhonakhbeeva/junior
Merge master into junior
2 parents 9786d22 + 3b39857 commit 70c1d4b

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed

plugins/robots/common/twoDModel/include/twoDModel/robotModel/twoDRobotModel.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class TWO_D_MODEL_EXPORT TwoDRobotModel : public kitBase::robotModel::CommonRobo
4747
QList<kitBase::robotModel::PortInfo> configurablePorts() const override;
4848
QList<kitBase::robotModel::DeviceInfo> convertibleBases() const override;
4949
int priority() const override;
50+
void rereadSettings() override;
5051

5152
/// Configures 2D model window`s engine for using it in 2D model devices emulators.
5253
void setEngine(engine::TwoDModelEngineInterface &engine);
@@ -128,6 +129,8 @@ class TWO_D_MODEL_EXPORT TwoDRobotModel : public kitBase::robotModel::CommonRobo
128129
/// Returns scanning angle and max distance by given device type.
129130
virtual QPair<qreal,int> rangeSensorAngleAndDistance (const kitBase::robotModel::DeviceInfo &deviceType) const;
130131

132+
signals:
133+
void settingsChanged();
131134
protected:
132135
kitBase::robotModel::robotParts::Device *createDevice(
133136
const kitBase::robotModel::PortInfo &port

plugins/robots/common/twoDModel/src/engine/view/scene/robotItem.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ RobotItem::RobotItem(const QString &robotImageFileName, model::RobotModel &robot
4545
connect(&mRobotModel.configuration(), &model::SensorsConfiguration::rotationChanged
4646
, this, &RobotItem::updateSensorRotation);
4747

48+
connect(&mRobotModel.info(), &twoDModel::robotModel::TwoDRobotModel::settingsChanged
49+
, this, &RobotItem::updateImage);
50+
4851
setAcceptHoverEvents(true);
4952
setAcceptDrops(true);
5053
setZValue(ZValue::Robot);
@@ -383,3 +386,8 @@ void RobotItem::BeepItem::drawBeepArcs(QPainter *painter, const QPointF &center,
383386
painter->drawArc(rect, 225 * 16, 90 * 16);
384387
painter->restore();
385388
}
389+
390+
void RobotItem::updateImage()
391+
{
392+
mImage.loadFrom(mRobotModel.info().robotImage());
393+
}

plugins/robots/common/twoDModel/src/engine/view/scene/robotItem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class RobotItem : public graphicsUtils::RotateItem, public items::SolidItem
110110
void ride(const QPointF &newPos, qreal rotation);
111111

112112
void onLanded();
113+
void updateImage();
113114

114115
/** @brief Image of a robot drawn on scene */
115116
model::Image mImage;

plugins/robots/common/twoDModel/src/robotModel/twoDRobotModel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,8 @@ DeviceInfo TwoDRobotModel::markerInfo() const
222222
{
223223
return DeviceInfo::create<parts::Marker>();
224224
}
225+
226+
void TwoDRobotModel::rereadSettings()
227+
{
228+
emit settingsChanged();
229+
}

0 commit comments

Comments
 (0)