summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2021-08-10 00:02:04 +0000
committerAndreas Kling <kling@serenityos.org>2021-08-10 21:56:47 +0200
commit8c1a6a8436600e4b0467ac66705e0abc7407f5bd (patch)
tree344ccfef5c542e2b3a1fc486dafdadda5cca7f91 /Userland/Libraries/LibGUI
parente1ed1d91766781324da903a583fd6f5b8a5e1a50 (diff)
downloadserenity-8c1a6a8436600e4b0467ac66705e0abc7407f5bd.zip
LibGUI: Default TreeView to SelectionBehavior::SelectItems
AbstractTableView (which TreeView inherits from) sets the selection behavior of the view to SelectRows. This is not how TreeViews are used in most of the system, and TreeView::paint_event actually always draws with the assumption of selecting individual items. This commit defines the expected selection behavior for TreeViews. Users of TreeView can still override this via TreeView::set_selection_behavior.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/TreeView.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/TreeView.cpp b/Userland/Libraries/LibGUI/TreeView.cpp
index 1ec3202e92..50e1de35d9 100644
--- a/Userland/Libraries/LibGUI/TreeView.cpp
+++ b/Userland/Libraries/LibGUI/TreeView.cpp
@@ -34,6 +34,7 @@ TreeView::MetadataForIndex& TreeView::ensure_metadata_for_index(const ModelIndex
TreeView::TreeView()
{
+ set_selection_behavior(SelectionBehavior::SelectItems);
set_fill_with_background_color(true);
set_background_role(ColorRole::Base);
set_foreground_role(ColorRole::BaseText);