Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved]Execute query when window opens.
Forum Updated to NodeBB v4.3 + New Features

[solved]Execute query when window opens.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 540 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andrewhopps
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      "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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved