Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[solved]Execute query when window opens.
andrewhopps last edited by
I have a listview that is populated from a database on a separate window than my mainwindow, and the code is placed right under the setupui area so it is populated when opened. (Anyone who could give me the name of that particular area would be good to know)
Upon creating an open and close function for the database, it cycles open and close until qt shuts it down. How do I query and populate the listview by only opening the window?
"setupui area" ? Are you referring to the constructor code ? The widget itself ?
Just open the database connection at application startup. From then on you can use it to create models etc. where you need them
Hope it helps