mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:52:45 +00:00 
			
		
		
		
	Applications: Use placeholders in TextBoxes where applicable
This commit is contained in:
		
							parent
							
								
									fa96e57c15
								
							
						
					
					
						commit
						7907df7617
					
				
					 4 changed files with 4 additions and 15 deletions
				
			
		|  | @ -103,6 +103,7 @@ Tab::Tab(Type type) | |||
|     m_location_box = toolbar.add<GUI::TextBox>(); | ||||
|     m_location_box->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); | ||||
|     m_location_box->set_preferred_size(0, 22); | ||||
|     m_location_box->set_placeholder("Address"); | ||||
| 
 | ||||
|     m_location_box->on_return_pressed = [this] { | ||||
|         auto url = url_from_user_input(m_location_box->text()); | ||||
|  |  | |||
|  | @ -122,11 +122,7 @@ int main(int argc, char* argv[]) | |||
|     auto& search_list_view = search_view.add<GUI::ListView>(); | ||||
|     search_box.set_preferred_size(0, 20); | ||||
|     search_box.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); | ||||
|     search_box.set_text("Search..."); | ||||
|     search_box.on_focusin = [&] { | ||||
|         if (search_box.text() == "Search...") | ||||
|             search_box.set_text(""); | ||||
|     }; | ||||
|     search_box.set_placeholder("Search..."); | ||||
|     search_box.on_change = [&] { | ||||
|         if (auto model = search_list_view.model()) { | ||||
|             auto& search_model = *static_cast<GUI::FilteringProxyModel*>(model); | ||||
|  | @ -134,15 +130,6 @@ int main(int argc, char* argv[]) | |||
|             search_model.update(); | ||||
|         } | ||||
|     }; | ||||
|     search_box.on_focusout = [&] { | ||||
|         if (search_box.text().is_empty()) { | ||||
|             if (auto model = search_list_view.model()) { | ||||
|                 auto& search_model = *static_cast<GUI::FilteringProxyModel*>(model); | ||||
|                 search_model.set_filter_term(""); | ||||
|             } | ||||
|             search_box.set_text("Search..."); | ||||
|         } | ||||
|     }; | ||||
|     search_list_view.set_model(GUI::FilteringProxyModel::construct(model)); | ||||
|     search_list_view.model()->update(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -202,6 +202,7 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na | |||
|         m_text_box->clear(); | ||||
|     }; | ||||
|     m_text_box->set_history_enabled(true); | ||||
|     m_text_box->set_placeholder("Message"); | ||||
| 
 | ||||
|     m_client->register_subwindow(*this); | ||||
| } | ||||
|  |  | |||
|  | @ -221,7 +221,7 @@ int main(int argc, char** argv) | |||
|     textbox_vert2_container.layout()->set_margins({ 1, 12, 1, 4 }); | ||||
| 
 | ||||
|     auto& textbox1 = textbox_vert1_container.add<GUI::TextBox>(); | ||||
|     textbox1.set_text("Editable"); | ||||
|     textbox1.set_placeholder("Editable"); | ||||
|     auto& textbox2 = textbox_vert1_container.add<GUI::TextBox>(); | ||||
|     textbox2.set_text("Disabled"); | ||||
|     textbox2.set_enabled(false); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Peter Elliott
						Peter Elliott