소스 검색

LibGUI: Use ColorRole::DisabledText when AbstractView is disabled

And only paint GlyphMapWidget's frame if disabled
thankyouverycool 2 년 전
부모
커밋
aaf60053f1
2개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      Userland/Libraries/LibGUI/AbstractView.cpp
  2. 3 0
      Userland/Libraries/LibGUI/GlyphMapWidget.cpp

+ 3 - 1
Userland/Libraries/LibGUI/AbstractView.cpp

@@ -715,7 +715,9 @@ void AbstractView::draw_item_text(Gfx::Painter& painter, ModelIndex const& index
         return;
 
     Color text_color;
-    if (is_selected)
+    if (!is_enabled())
+        text_color = palette().color(Gfx::ColorRole::DisabledText);
+    else if (is_selected)
         text_color = is_focused() ? palette().selection_text() : palette().inactive_selection_text();
     else
         text_color = index.data(ModelRole::ForegroundColor).to_color(palette().color(foreground_role()));

+ 3 - 0
Userland/Libraries/LibGUI/GlyphMapWidget.cpp

@@ -120,6 +120,9 @@ void GlyphMapWidget::paint_event(PaintEvent& event)
 {
     Frame::paint_event(event);
 
+    if (!is_enabled())
+        return;
+
     Painter painter(*this);
     painter.add_clip_rect(widget_inner_rect());
     painter.add_clip_rect(event.rect());