From: nds Date: Tue, 9 Dec 2014 06:04:56 +0000 (+0300) Subject: Icons correction X-Git-Tag: before_slalome_7.5.1~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3e5ce33f52af713f431dd0aae09602fd072cb42c;p=modules%2Fshaper.git Icons correction --- diff --git a/src/ModuleBase/ModuleBase_Tools.cpp b/src/ModuleBase/ModuleBase_Tools.cpp index 0f57b4c7b..843c4cd51 100644 --- a/src/ModuleBase/ModuleBase_Tools.cpp +++ b/src/ModuleBase/ModuleBase_Tools.cpp @@ -44,8 +44,7 @@ void zeroMargins(QLayout* theLayout) 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); @@ -59,12 +58,12 @@ QPixmap composite(const QString& theAdditionalIcon, const int theXShift, 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)); diff --git a/src/ModuleBase/ModuleBase_Tools.h b/src/ModuleBase/ModuleBase_Tools.h index 3f9ca0219..9435d485b 100644 --- a/src/ModuleBase/ModuleBase_Tools.h +++ b/src/ModuleBase/ModuleBase_Tools.h @@ -32,12 +32,9 @@ MODULEBASE_EXPORT void zeroMargins(QLayout* theLayout); //! 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. diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 0bf4c4bcb..301839bf2 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -76,21 +76,17 @@ QMap 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) { @@ -102,13 +98,12 @@ QIcon XGUI_Workshop::featureIcon(const FeaturePtr& theFeature) } 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; diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 95a70579a..2805b712a 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -146,9 +146,6 @@ Q_OBJECT //! 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 theFeature);