theLayout->setSpacing(5);
}
-QPixmap composite(const QString& theAdditionalIcon, const int theXShift,
- const int theYShift, const QString& theIcon)
+QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon)
{
QImage anIcon(theIcon);
QImage anAditional(theAdditionalIcon);
int aWidth = anIcon.width();
int aHeight = anIcon.height();
- int aStartWidthPos = aWidth-anAddWidth-1;
- int aStartHeightPos = aHeight-anAddHeight-1;
+ int aStartWidthPos = aWidth - anAddWidth - 1;
+ int aStartHeightPos = aHeight - anAddHeight - 1;
- for (int i = 0; i < anAddWidth; i++)
+ for (int i = 0; i < anAddWidth && i + aStartWidthPos < aWidth; i++)
{
- for (int j = 0; j < anAddHeight; j++)
+ for (int j = 0; j < anAddHeight && j + aStartHeightPos < aHeight; j++)
{
if (qAlpha(anAditional.pixel(i, j)) > 0)
anIcon.setPixel(i + aStartWidthPos, j + aStartHeightPos, anAditional.pixel(i, j));
//! specified relatively to the upper left corner of \a theIcon.
//! \param theAdditionalIcon resource text of the additional pixmap
-//! \param theXShift horizontal shift
-//! \param theYShift vertical shift
//! \param theIcon resource text of the background pixmap
//! \return resulting pixmap
-MODULEBASE_EXPORT QPixmap composite(const QString& theAdditionalIcon, const int theXShift,
- const int theYShift, const QString& theIcon);
+MODULEBASE_EXPORT QPixmap composite(const QString& theAdditionalIcon, const QString& theIcon);
//! Generates the pixmap lighter than the resources pixmap.
//! Pixmap \a theIcon is lighted according to the given value.
QMap<QString, QString> XGUI_Workshop::myIcons;
-std::string XGUI_Workshop::featureIconStr(const FeaturePtr& theFeature)
-{
- std::string aKind = theFeature->getKind();
- QString aId(aKind.c_str());
- if (!myIcons.contains(aId))
- return std::string();
-
- return myIcons[aId].toStdString();
-}
QIcon XGUI_Workshop::featureIcon(const FeaturePtr& theFeature)
{
QIcon anIcon;
- QString anIconString = featureIconStr(theFeature).c_str();
+ std::string aKind = theFeature->getKind();
+ QString aId(aKind.c_str());
+ if (!myIcons.contains(aId))
+ return anIcon;
+
+ QString anIconString = myIcons[aId];
ModelAPI_ExecState aState = theFeature->data()->execState();
switch(aState) {
}
break;
case ModelAPI_StateExecFailed: {
- anIcon = ModuleBase_Tools::composite(":pictures/exec_state_failed.png",
- 12, 12, anIconString);
+ anIcon = ModuleBase_Tools::composite(":pictures/exec_state_failed.png", anIconString);
}
break;
case ModelAPI_StateInvalidArgument: {
anIcon = ModuleBase_Tools::composite(":pictures/exec_state_invalid_parameters.png",
- 12, 12, anIconString);
+ anIconString);
}
break;
default: break;
//! Returns icon name according to feature
static QIcon featureIcon(const FeaturePtr& theFeature);
- //! Returns icon name according to feature
- static std::string featureIconStr(const FeaturePtr& theFeature);
-
//! Activates or deactivates a part
//! If PartPtr is Null pointer then PartSet will be activated
void activatePart(std::shared_ptr<ModelAPI_ResultPart> theFeature);