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]Add index value to database in QListWidgetItem
Forum Updated to NodeBB v4.3 + New Features

[Solved]Add index value to database in QListWidgetItem

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k 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.
  • W Offline
    W Offline
    weblife
    wrote on last edited by
    #1

    Is there a way to add my QSqlQueryModel to a QListWidget? Or is there a way to add the database row id to a QListWidgetItem? I cant figure this out from the "documentation":http://qt-project.org/doc/qt-4.8/qlistwidgetitem.html.

    Brandon Clark
    www.themindspot.com

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      Hmm, think your missing the point of the Model/View or widget/View use. For your database you should use the Model/View system, so it would be a QListView instead off a QListWidget. When the database has multiple colums maybe using the QTableView is more appropriate. In the model you control the way the view presents its data. Hope this helps, otherwise supply some code for us to debug/check.

      Greetz, Jeroen

      1 Reply Last reply
      0
      • W Offline
        W Offline
        weblife
        wrote on last edited by
        #3

        Yes. I had received similar advice from stackoverflow also. Although now I realize that class isn't enough either and I need to make my own widget based on some of these model/view classes.

        Brandon Clark
        www.themindspot.com

        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