From 6e7ca44dee53cc7f972f84b93dedf7aa8ac6e56a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 13 Feb 2020 21:45:46 +0100 Subject: [PATCH] LibGUI: Add GUI::Model::accepts_drag(index, data_type) This allows a model to indicate whether it would accept a drag with a given data type being dropped on a given index. --- Libraries/LibGUI/Model.cpp | 5 +++++ Libraries/LibGUI/Model.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Libraries/LibGUI/Model.cpp b/Libraries/LibGUI/Model.cpp index 219555587a..ff1ae8f730 100644 --- a/Libraries/LibGUI/Model.cpp +++ b/Libraries/LibGUI/Model.cpp @@ -77,4 +77,9 @@ ModelIndex Model::sibling(int row, int column, const ModelIndex& parent) const return index(row, column, parent); } +bool Model::accepts_drag(const ModelIndex&, const StringView&) +{ + return false; +} + } diff --git a/Libraries/LibGUI/Model.h b/Libraries/LibGUI/Model.h index 5195abfd70..d70df1dd86 100644 --- a/Libraries/LibGUI/Model.h +++ b/Libraries/LibGUI/Model.h @@ -88,6 +88,7 @@ public: virtual bool is_editable(const ModelIndex&) const { return false; } virtual void set_data(const ModelIndex&, const Variant&) {} virtual int tree_column() const { return 0; } + virtual bool accepts_drag(const ModelIndex&, const StringView& data_type); bool is_valid(const ModelIndex& index) const {