if (anIcon.isNull())
return QPixmap();
- for (int i = theXShift; i < anAditional.width() + theXShift && i < anIcon.width(); i++)
+ int anAddWidth = anAditional.width();
+ int anAddHeight = anAditional.height();
+
+ int aWidth = anIcon.width();
+ int aHeight = anIcon.height();
+
+ int aStartWidthPos = aWidth-anAddWidth-1;
+ int aStartHeightPos = aHeight-anAddHeight-1;
+
+ for (int i = 0; i < anAddWidth; i++)
{
- for (int j = theYShift; j < anAditional.height() + theYShift && j < anIcon.height(); j++)
+ for (int j = 0; j < anAddHeight; j++)
{
- if (qAlpha(anAditional.pixel(i - theXShift, j - theYShift)) > 0)
- anIcon.setPixel(i, j, anAditional.pixel(i - theXShift, j - theYShift));
+ if (qAlpha(anAditional.pixel(i, j)) > 0)
+ anIcon.setPixel(i + aStartWidthPos, j + aStartHeightPos, anAditional.pixel(i, j));
}
}
return QPixmap::fromImage(anIcon);
QMap<QString, QString> XGUI_Workshop::myIcons;
-QPixmap XGUI_Workshop::featureIcon(const FeaturePtr& theFeature)
+std::string XGUI_Workshop::featureIconStr(const FeaturePtr& theFeature)
{
- QPixmap aPixmap;
-
std::string aKind = theFeature->getKind();
QString aId(aKind.c_str());
if (!myIcons.contains(aId))
- return aPixmap;
+ return std::string();
+
+ return myIcons[aId].toStdString();
+}
- QString anIconString = myIcons[aId];
+QIcon XGUI_Workshop::featureIcon(const FeaturePtr& theFeature)
+{
+ QIcon anIcon;
+
+ QString anIconString = featureIconStr(theFeature).c_str();
ModelAPI_ExecState aState = theFeature->data()->execState();
switch(aState) {
case ModelAPI_StateDone:
case ModelAPI_StateNothing:
- aPixmap = QPixmap(anIconString);
- break;
+ anIcon = QIcon(anIconString);
case ModelAPI_StateMustBeUpdated: {
- aPixmap = ModuleBase_Tools::lighter(anIconString);
+ anIcon = ModuleBase_Tools::lighter(anIconString);
}
break;
case ModelAPI_StateExecFailed: {
- aPixmap = ModuleBase_Tools::composite(":pictures/exec_state_failed.png",
+ anIcon = ModuleBase_Tools::composite(":pictures/exec_state_failed.png",
12, 12, anIconString);
}
break;
case ModelAPI_StateInvalidArgument: {
- aPixmap = ModuleBase_Tools::composite(":pictures/exec_state_invalid_parameters.png",
+ anIcon = ModuleBase_Tools::composite(":pictures/exec_state_invalid_parameters.png",
12, 12, anIconString);
}
break;
default: break;
}
-
- return aPixmap;
+ return anIcon;
}
XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
#include <QObject>
#include <QMap>
#include <QKeySequence>
-#include <QPixmap>
+#include <QIcon>
class XGUI_MainWindow;
class XGUI_Command;
return myModuleConnector;
}
- //! Returns icon name according to feature Id
- static QPixmap featureIcon(const FeaturePtr& theFeature);
+ //! 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