浏览代码

LibGUI: Show dotfiles with 50% opacity (in FileSystemModel views)

Use the new ModelRole::IconOpacity for this. :^)
Andreas Kling 4 年之前
父节点
当前提交
75a41da69f
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      Userland/Libraries/LibGUI/FileSystemModel.cpp

+ 7 - 0
Userland/Libraries/LibGUI/FileSystemModel.cpp

@@ -515,6 +515,13 @@ Variant FileSystemModel::data(const ModelIndex& index, ModelRole role) const
     if (role == ModelRole::Icon) {
         return icon_for(node);
     }
+
+    if (role == ModelRole::IconOpacity) {
+        if (node.name.starts_with('.'))
+            return 0.5f;
+        return {};
+    }
+
     return {};
 }