In this recipe, we will be prompting the user to enter a database name, followed by clicking the push button. Upon clicking the push button, if the specified database does not exist, it is created and, if it already exists, it is connected.
Creating a database
How to do it…
Follow this step-by-step procedure to create a database in SQLite:
- Let's create an application based on the Dialog without Buttons template.
- Add two QLabel widgets, one QLineEdit widget, and one QPushButton widget to the form by dragging and dropping two Label widget, one Line Edit widget, and a Push Button widget on the form.
- Set the text property of the first Label widget to Enter database name.
- Delete the text property...