diff --git a/LibGUI/GTableView.cpp b/LibGUI/GTableView.cpp index 0f98f1eac8..b2c4011128 100644 --- a/LibGUI/GTableView.cpp +++ b/LibGUI/GTableView.cpp @@ -103,9 +103,11 @@ void GTableView::paint_event(GPaintEvent&) painter.fill_rect({ 0, 0, width(), header_height() }, Color::LightGray); int x_offset = 0; for (int column_index = 0; column_index < m_model->column_count(); ++column_index) { - Rect cell_rect(horizontal_padding + x_offset, 0, m_model->column_width(column_index), item_height()); - painter.draw_text(cell_rect, m_model->column_name(column_index), TextAlignment::CenterLeft, Color::Black); + Rect cell_rect(x_offset, 0, m_model->column_width(column_index) + horizontal_padding, item_height()); + painter.draw_text(cell_rect.translated(horizontal_padding, 0), m_model->column_name(column_index), TextAlignment::CenterLeft, Color::Black); x_offset += m_model->column_width(column_index) + horizontal_padding; + painter.draw_line(cell_rect.top_left(), cell_rect.bottom_left(), Color::White); + painter.draw_line(cell_rect.top_right(), cell_rect.bottom_right(), Color::DarkGray); } painter.draw_line({ 0, 0 }, { width() - 1, 0 }, Color::White); painter.draw_line({ 0, header_height() - 1 }, { width() - 1, header_height() - 1 }, Color::DarkGray); diff --git a/SharedGraphics/Rect.h b/SharedGraphics/Rect.h index 3b5d7538c8..dc095166f4 100644 --- a/SharedGraphics/Rect.h +++ b/SharedGraphics/Rect.h @@ -191,6 +191,11 @@ public: Rect united(const Rect&) const; + Point top_left() const { return { left(), top() }; } + Point top_right() const { return { right(), top() }; } + Point bottom_left() const { return { left(), bottom() }; } + Point bottom_right() const { return { right(), bottom() }; } + String to_string() const { return String::format("[%d,%d %dx%d]", x(), y(), width(), height()); } private: