Prechádzať zdrojové kódy

LibGUI: Calculate the text rect correctly in AbstractTableView

This fixes the misalignments when a header is not left-aligned.
AnotherTest 4 rokov pred
rodič
commit
09ccb46980
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  1. 1 1
      Libraries/LibGUI/AbstractTableView.cpp

+ 1 - 1
Libraries/LibGUI/AbstractTableView.cpp

@@ -162,7 +162,7 @@ void AbstractTableView::paint_headers(Painter& painter)
         } else {
         } else {
             text = model()->column_name(column_index);
             text = model()->column_name(column_index);
         }
         }
-        auto text_rect = cell_rect.translated(horizontal_padding(), 0);
+        auto text_rect = cell_rect.shrunken(horizontal_padding() * 2, 0);
         if (pressed)
         if (pressed)
             text_rect.move_by(1, 1);
             text_rect.move_by(1, 1);
         painter.draw_text(text_rect, text, header_font(), column_header_alignment(column_index), palette().button_text());
         painter.draw_text(text_rect, text, header_font(), column_header_alignment(column_index), palette().button_text());