]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1305: Make different gray color for selectable and non-selectable items
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 1 Apr 2016 11:15:18 +0000 (14:15 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Fri, 1 Apr 2016 11:15:31 +0000 (14:15 +0300)
src/XGUI/XGUI_DataModel.cpp

index fa38f0a1d4a129570bd723d9a2d22d54a2dee8fa..ce5ab3879a8eeef10a960f6db5ebdb3c582a4431 100644 (file)
 
 /// 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<ModelAPI_Feature*>(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;
     }