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] What would be the best way to display a list of items in Qt
Qt 6.11 is out! See what's new in the release blog

[SOLVED] What would be the best way to display a list of items in Qt

Scheduled Pinned Locked Moved General and Desktop
24 Posts 5 Posters 11.8k 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.
  • F Offline
    F Offline
    fs_tigre
    wrote on last edited by
    #7

    Thanks a lot for your help.

    Where should I start looking if I want to go with an SQL database?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #8

      Again: it doesn't solve your issue, so perhaps you should try to solve one issue at a time and not confuse yourself with adding yet more new technologies you'll need to learn.

      Anyway, more on using SQL in qt can be found my reading the documentation that appears if you enter "qsql" as the filter for the documentation index in creator. Start with reading the [[doc:QSqlDatabase]] docs.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fs_tigre
        wrote on last edited by
        #9

        Ok, can you please tell me what would you used if you had to do what a list of 150 items where adding and deleting is involved?

        As always thanks a lot for you help!

        1 Reply Last reply
        0
        • K Offline
          K Offline
          KA51O
          wrote on last edited by
          #10

          So you want to read and write data from different workstations and keep the data consistent ?
          I would suggest that before you think about how to display the data, you should think about how you want to achieve the task of the interaction.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fs_tigre
            wrote on last edited by
            #11

            bq. So you want to read and write data from different workstations and keep the data consistent ?

            Yes.

            bq. I would suggest that before you think about how to display the data, you should think about how you want to achieve the task of the interaction.

            Well I'm actually more concern about the interaction than the display part, I just need advice from the experts to find the best solution.

            Thanks

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #12

              I'd build a data structure that properly describes what I'm dealing with, and provides a sane API to manipulate it in the ways I need.

              What worries me is this sentence:

              [quote author="fs_tigre" date="1343216153"]I forgot to mention one thing and probably the most important one is that this file will need to be access by multiple users, in other words any user can modify the file (file will be in a share drive).[/quote]
              Does this mean that you'll be doing live updates with multiple users on the same data, and that you expect the data to be updated for all users at that moment? Because that is going to be quite tricky to do, and is not something you can explain how to do in a simple way.

              1 Reply Last reply
              0
              • K Offline
                K Offline
                KA51O
                wrote on last edited by
                #13

                My first thought was to have a server that reads the initial (text, xml, JSON,..) document into an custom datastructure and maintains its state. The workstations would then access the data (for read and write operations) via an interface (CORBA, WebService, TCP,...) provided by the server.

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  fs_tigre
                  wrote on last edited by
                  #14

                  Ok, it looks like this is a complicated task which I'm not prepared for yet.

                  So far the best solution I think is to use the QTextEdit, load the .txt file, change as needed and save it again.

                  Last question, if I go with the QTextEdit I'm describing here, what would be the best way to style the content in the .txt file? Do I need to work with an HTML file instead?

                  Side note: I'm very proficient in HTML and CSS.

                  Thanks

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    fs_tigre
                    wrote on last edited by
                    #15

                    I got my own answer on this one, it looks like I can work with an HTML file and use embedded CSS for styling.

                    Thank you for your time, believe it or not I learn a lot about this topic, my limitations about .txt files etc.

                    Thanks a lot

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tobias.hunger
                      wrote on last edited by
                      #16

                      150 people, all editing the same file containing data? That sounds like a job for a database...

                      1 Reply Last reply
                      0
                      • F Offline
                        F Offline
                        fs_tigre
                        wrote on last edited by
                        #17

                        No!

                        150 Items on the list.
                        10 Users.

                        The file will only be updated once or twice a YEAR by a random user.

                        Thanks a lot

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          tobias.hunger
                          wrote on last edited by
                          #18

                          Still sounds like you want a database to me:-)

                          1 Reply Last reply
                          0
                          • F Offline
                            F Offline
                            fs_tigre
                            wrote on last edited by
                            #19

                            Thanks for the advice!

                            1 Reply Last reply
                            0
                            • A Offline
                              A Offline
                              andre
                              wrote on last edited by
                              #20

                              You might or you might not want a database, but using a database as a storage mechism will not help you solve the display issue. They are independent.

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                KA51O
                                wrote on last edited by
                                #21

                                How about "QSqlTabelModel":http://qt-project.org/doc/qt-4.8/qsqltablemodel.html and "QTableView":http://qt-project.org/doc/qt-4.8/qtableview.html? I haven't used this combination, but combined with QSqlDatabase it sounds quite useful.

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  andre
                                  wrote on last edited by
                                  #22

                                  It is useful, but it does not provide the grouping that fs_tigre is looking for. QSqlTableModel provides a table, as the name already implies, while you would need a tree model to create the grouping. At least in the Qt widget world. QML of course has a list view that has grouping build in based on a flat list...

                                  1 Reply Last reply
                                  0
                                  • K Offline
                                    K Offline
                                    KA51O
                                    wrote on last edited by
                                    #23

                                    Oh you're right I forgot about the hierachy.

                                    1 Reply Last reply
                                    0
                                    • F Offline
                                      F Offline
                                      fs_tigre
                                      wrote on last edited by
                                      #24

                                      Thank you all, I'm actually using HTML and loading and saving the whole file every time a change is made.

                                      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