mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:17:34 +00:00
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.
This commit is contained in:
parent
d75cf27e02
commit
11f82a32d4
1 changed files with 3 additions and 1 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue