mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 00:32:06 +00:00
LibGUI: Implement automatic scrolling in AbstractView
This adds automatic scrolling when dragging items in TreeViews and other widgets that inherit from AbstractView when the overloaded accepts_drag() returns true. This is implemented in FileSystemModel to allow directories and files to be dragged.
This commit is contained in:
parent
53cfc6ec9f
commit
d660e86d13
6 changed files with 45 additions and 7 deletions
|
@ -711,10 +711,12 @@ String FileSystemModel::column_name(int column) const
|
|||
|
||||
bool FileSystemModel::accepts_drag(ModelIndex const& index, Vector<String> const& mime_types) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return false;
|
||||
if (!mime_types.contains_slow("text/uri-list"))
|
||||
return false;
|
||||
|
||||
if (!index.is_valid())
|
||||
return true;
|
||||
|
||||
auto& node = this->node(index);
|
||||
return node.is_directory();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue