From: vsv Date: Fri, 1 Apr 2016 11:15:18 +0000 (+0300) Subject: Issue #1305: Make different gray color for selectable and non-selectable items X-Git-Tag: V_2.3.0~347 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=69f24ed0c499d441e2ab0ed19b9bfd15b1df9824;p=modules%2Fshaper.git Issue #1305: Make different gray color for selectable and non-selectable items --- diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp index fa38f0a1d..ce5ab3879 100644 --- a/src/XGUI/XGUI_DataModel.cpp +++ b/src/XGUI/XGUI_DataModel.cpp @@ -32,6 +32,10 @@ /// Returns ResultPart object if the given object is a Part feature /// Otherwise returns NULL + +#define SELECTABLE_COLOR QColor(80, 80, 80) +#define DISABLED_COLOR QColor(200, 200, 200) + ResultPartPtr getPartResult(ModelAPI_Object* theObj) { ModelAPI_Feature* aFeature = dynamic_cast(theObj); @@ -371,14 +375,22 @@ QVariant XGUI_DataModel::data(const QModelIndex& theIndex, int theRole) const case Qt::DecorationRole: return QIcon(myXMLReader.rootFolderIcon(theIndexRow).c_str()); case Qt::ForegroundRole: - if ((theIndex.flags() & Qt::ItemIsEditable) == 0) - return QBrush(Qt::lightGray); + { + Qt::ItemFlags aFlags = theIndex.flags(); + if (aFlags == Qt::ItemFlags()) + return QBrush(DISABLED_COLOR); + if (!aFlags.testFlag(Qt::ItemIsEditable)) + return QBrush(SELECTABLE_COLOR); + } return ACTIVE_COLOR; } } else { // an object or sub-document if (theRole == Qt::ForegroundRole) { - if ((theIndex.flags() & Qt::ItemIsEditable) == 0) - return QBrush(Qt::lightGray); + Qt::ItemFlags aFlags = theIndex.flags(); + if (aFlags == Qt::ItemFlags()) + return QBrush(DISABLED_COLOR); + if (!aFlags.testFlag(Qt::ItemIsEditable)) + return QBrush(SELECTABLE_COLOR); return ACTIVE_COLOR; }