Преглед изворни кода

GDirectoryModel: Allow retrieving an item's full path via Role::Custom

Andreas Kling пре 5 година
родитељ
комит
13ca1ee8dc
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      Libraries/LibGUI/GDirectoryModel.cpp

+ 4 - 0
Libraries/LibGUI/GDirectoryModel.cpp

@@ -238,6 +238,10 @@ GVariant GDirectoryModel::data(const GModelIndex& index, Role role) const
 {
 {
     ASSERT(is_valid(index));
     ASSERT(is_valid(index));
     auto& entry = this->entry(index.row());
     auto& entry = this->entry(index.row());
+    if (role == Role::Custom) {
+        ASSERT(index.column() == Column::Name);
+        return entry.full_path(*this);
+    }
     if (role == Role::Sort) {
     if (role == Role::Sort) {
         switch (index.column()) {
         switch (index.column()) {
         case Column::Icon:
         case Column::Icon: