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. Fill a QTableView
Qt 6.11 is out! See what's new in the release blog

Fill a QTableView

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 567 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
    AndreaCT
    wrote on last edited by
    #1

    Hi!

    In my football application I want to give the opportunity to view the championship standings in a given range of days.

    In the database I only have the general classification, but I can easily get all the information (teams / points / v / n / p / goal scored / etc) from the sql table relating to the championship calendar.

    I thought of an array of structures. Other ideas?

    406ec8c6-e6ec-4db0-ac29-d9559bd26bf0-image.png

    Eventually how do I connect it to the table?

    Thanks

    Pl45m4P VRoninV 2 Replies Last reply
    0
    • A AndreaCT

      Hi!

      In my football application I want to give the opportunity to view the championship standings in a given range of days.

      In the database I only have the general classification, but I can easily get all the information (teams / points / v / n / p / goal scored / etc) from the sql table relating to the championship calendar.

      I thought of an array of structures. Other ideas?

      406ec8c6-e6ec-4db0-ac29-d9559bd26bf0-image.png

      Eventually how do I connect it to the table?

      Thanks

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @AndreaCT

      Either a struct or you make it an extra class.
      Then you could do something like:
      QVector<YourClass *> m_scoreList;


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      0
      • A AndreaCT

        Hi!

        In my football application I want to give the opportunity to view the championship standings in a given range of days.

        In the database I only have the general classification, but I can easily get all the information (teams / points / v / n / p / goal scored / etc) from the sql table relating to the championship calendar.

        I thought of an array of structures. Other ideas?

        406ec8c6-e6ec-4db0-ac29-d9559bd26bf0-image.png

        Eventually how do I connect it to the table?

        Thanks

        VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #3

        @AndreaCT said in Fill a QTableView:

        but I can easily get all the information (teams / points / v / n / p / goal scored / etc) from the sql table relating to the championship calendar.

        Can't you just use QSqlQueryModel directly without any overhead?

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AndreaCT
          wrote on last edited by
          #4

          @VRonin said in Fill a QTableView:

          Can't you just use QSqlQueryModel directly without any overhead?

          I get the information from the database, but not directly. I do multiple queries: the first one scans all the teams, the second one selects the matches and results of the current team and obtains the informations.

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #5

            I would try QStandardItemModel for ease of use. you can build a custom model on top of your custom data but it's painful and easy to get wrong so I'd avoid it if you can

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AndreaCT
              wrote on last edited by
              #6

              Solved with simple tableWidget, without model and array struct.

              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