mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 13:20:59 +00:00 
			
		
		
		
	GItemView: Elide item names that won't fit
This isn't perfect since now you will just see "Long name..." instead of the whole name, but at least it doesn't look totally wrong either.
This commit is contained in:
		
							parent
							
								
									9f99e285d1
								
							
						
					
					
						commit
						77d6dbc236
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-19 12:06:14 +09:00 
				
			
			Author: https://github.com/awesomekling
Commit: 77d6dbc236
			
					 1 changed files with 2 additions and 1 deletions
				
			
		|  | @ -167,6 +167,7 @@ void GItemView::paint_event(GPaintEvent& event) | |||
|         Rect text_rect { 0, icon_rect.bottom() + 6 + 1, font.width(item_text.to_string()), font.glyph_height() }; | ||||
|         text_rect.center_horizontally_within(item_rect); | ||||
|         text_rect.inflate(6, 4); | ||||
|         text_rect.intersect(item_rect); | ||||
| 
 | ||||
|         Color text_color; | ||||
|         if (is_selected_item) | ||||
|  | @ -174,7 +175,7 @@ void GItemView::paint_event(GPaintEvent& event) | |||
|         else | ||||
|             text_color = model()->data(model_index, GModel::Role::ForegroundColor).to_color(Color::Black); | ||||
|         painter.fill_rect(text_rect, background_color); | ||||
|         painter.draw_text(text_rect, item_text.to_string(), font, TextAlignment::Center, text_color); | ||||
|         painter.draw_text(text_rect, item_text.to_string(), font, TextAlignment::Center, text_color, TextElision::Right); | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling