summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorKarol Kosek <krkk@serenityos.org>2022-03-14 16:45:47 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-14 22:29:57 +0100
commit11f82a32d4432f217d3e45de120e6d9348d0161b (patch)
tree6dc4e8d062d3f3bc46794be8b4ea8e8cb8abce56 /Userland/Libraries/LibGUI
parentd75cf27e02a071f9e2cf40f141bbab967add381c (diff)
downloadserenity-11f82a32d4432f217d3e45de120e6d9348d0161b.zip
LibGUI: Use preferred font line height for item heights in ListView
Previously, changing the font to one with a height greater than 18 meant that no text was visible in the list items anymore.
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/ListView.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGUI/ListView.h b/Userland/Libraries/LibGUI/ListView.h
index ffcd25bc4a..3edbfece64 100644
--- a/Userland/Libraries/LibGUI/ListView.h
+++ b/Userland/Libraries/LibGUI/ListView.h
@@ -15,7 +15,7 @@ class ListView : public AbstractView {
public:
virtual ~ListView() override;
- int item_height() const { return 16; }
+ int item_height() const { return font().preferred_line_height() + vertical_padding(); }
bool alternating_row_colors() const { return m_alternating_row_colors; }
void set_alternating_row_colors(bool b) { m_alternating_row_colors = b; }
@@ -24,6 +24,7 @@ public:
void set_hover_highlighting(bool b) { m_hover_highlighting = b; }
int horizontal_padding() const { return m_horizontal_padding; }
+ int vertical_padding() const { return m_vertical_padding; }
virtual void scroll_into_view(const ModelIndex& index, bool scroll_horizontally, bool scroll_vertically) override;
@@ -58,6 +59,7 @@ private:
void update_content_size();
int m_horizontal_padding { 2 };
+ int m_vertical_padding { 2 };
int m_model_column { 0 };
bool m_alternating_row_colors { true };
bool m_hover_highlighting { false };