Skip to content

Commit

Permalink
Merge pull request #1124 from IKhonakhbeeva/junior
Browse files Browse the repository at this point in the history
Merge master into junior
  • Loading branch information
iakov committed Sep 29, 2020
2 parents 9786d22 + 3b39857 commit 70c1d4b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
Expand Up @@ -47,6 +47,7 @@ class TWO_D_MODEL_EXPORT TwoDRobotModel : public kitBase::robotModel::CommonRobo
QList<kitBase::robotModel::PortInfo> configurablePorts() const override;
QList<kitBase::robotModel::DeviceInfo> convertibleBases() const override;
int priority() const override;
void rereadSettings() override;

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

signals:
void settingsChanged();
protected:
kitBase::robotModel::robotParts::Device *createDevice(
const kitBase::robotModel::PortInfo &port
Expand Down
Expand Up @@ -45,6 +45,9 @@ RobotItem::RobotItem(const QString &robotImageFileName, model::RobotModel &robot
connect(&mRobotModel.configuration(), &model::SensorsConfiguration::rotationChanged
, this, &RobotItem::updateSensorRotation);

connect(&mRobotModel.info(), &twoDModel::robotModel::TwoDRobotModel::settingsChanged
, this, &RobotItem::updateImage);

setAcceptHoverEvents(true);
setAcceptDrops(true);
setZValue(ZValue::Robot);
Expand Down Expand Up @@ -383,3 +386,8 @@ void RobotItem::BeepItem::drawBeepArcs(QPainter *painter, const QPointF &center,
painter->drawArc(rect, 225 * 16, 90 * 16);
painter->restore();
}

void RobotItem::updateImage()
{
mImage.loadFrom(mRobotModel.info().robotImage());
}
Expand Up @@ -110,6 +110,7 @@ class RobotItem : public graphicsUtils::RotateItem, public items::SolidItem
void ride(const QPointF &newPos, qreal rotation);

void onLanded();
void updateImage();

/** @brief Image of a robot drawn on scene */
model::Image mImage;
Expand Down
Expand Up @@ -222,3 +222,8 @@ DeviceInfo TwoDRobotModel::markerInfo() const
{
return DeviceInfo::create<parts::Marker>();
}

void TwoDRobotModel::rereadSettings()
{
emit settingsChanged();
}

0 comments on commit 70c1d4b

Please sign in to comment.