Although you can add items to the List Widget item manually through Property Editor, sometimes you need to add items to the List Widget item dynamically through code. Let's create an application that explains the process of adding items to List Widget.
In this application, you will use Label, Line Edit, Push Button, and List Widget. The List Widget item will be empty initially, and the user is asked to enter desired food items into Line Edit and select an Add to List button. The entered food item will then be added to the List Widget item. All subsequent food items will be added below the previous entry.