summaryrefslogtreecommitdiff
path: root/LibGUI/GModel.h
diff options
context:
space:
mode:
Diffstat (limited to 'LibGUI/GModel.h')
-rw-r--r--LibGUI/GModel.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/LibGUI/GModel.h b/LibGUI/GModel.h
index 03f6b2d7f5..4dd2df72ae 100644
--- a/LibGUI/GModel.h
+++ b/LibGUI/GModel.h
@@ -76,7 +76,8 @@ public:
Function<void(GModel&)> on_model_update;
Function<void(const GModelIndex&)> on_selection_changed;
- virtual GModelIndex index(int row, int column) const { return create_index(row, column); }
+ virtual GModelIndex parent_index(const GModelIndex&) const { return { }; }
+ virtual GModelIndex index(int row, int column = 0, const GModelIndex& = GModelIndex()) const { return create_index(row, column); }
protected:
GModel();
@@ -91,3 +92,8 @@ private:
GModelIndex m_selected_index;
bool m_activates_on_selection { false };
};
+
+inline GModelIndex GModelIndex::parent() const
+{
+ return m_model ? m_model->parent_index(*this) : GModelIndex();
+}