فهرست منبع

LibGUI: Fix tree view column positioning when some columns are hidden

Sergey Bugaev 5 سال پیش
والد
کامیت
303fa75d36
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 2
      Libraries/LibGUI/GTreeView.cpp

+ 4 - 2
Libraries/LibGUI/GTreeView.cpp

@@ -100,7 +100,8 @@ void GTreeView::traverse_in_paint_order(Callback callback) const
     int tree_column_x_offset = 0;
 
     for (int i = 0; i < tree_column; ++i) {
-        tree_column_x_offset += column_width(i);
+        if (!is_column_hidden(i))
+            tree_column_x_offset += column_width(i);
     }
 
     Function<IterationDecision(const GModelIndex&)> traverse_index = [&](const GModelIndex& index) {
@@ -162,7 +163,8 @@ void GTreeView::paint_event(GPaintEvent& event)
     int tree_column = model.tree_column();
     int tree_column_x_offset = 0;
     for (int i = 0; i < tree_column; ++i) {
-        tree_column_x_offset += column_width(i);
+        if (!is_column_hidden(i))
+            tree_column_x_offset += column_width(i);
     }
     int y_offset = header_height();