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. Populating TreeView data from external QSettings file
Forum Updated to NodeBB v4.3 + New Features

Populating TreeView data from external QSettings file

Scheduled Pinned Locked Moved General and Desktop
11 Posts 3 Posters 3.9k 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.
  • S Offline
    S Offline
    shayb
    wrote on last edited by
    #2

    please help anyone?...

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Skyrpex
      wrote on last edited by
      #3

      Not sure a t all, but I feel you need some basic programming notations. Do you know how to create a basic C++ tree structure?

      You should understand that before trying to use Qt's structures.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shayb
        wrote on last edited by
        #4

        Could you please refer me to a proper guide of C++ tree structure?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Skyrpex
          wrote on last edited by
          #5

          Just ask Google :-) Four example, you could start with binary trees

          1 Reply Last reply
          0
          • N Offline
            N Offline
            NicuPopescu
            wrote on last edited by
            #6

            check the examples in qt doc:
            "Simple Tree Model Example":qthelp://com.trolltech.qt.485/qdoc/itemviews-simpletreemodel.html
            "Editable Tree Model Example":qthelp://com.trolltech.qt.485/qdoc/itemviews-editabletreemodel.html

            or in your case, I think using direct a QTreeWdiget having a predefined model would be enough ... I would suggest to play with someone in QtCreator, add few items,build the project and then check the ui header file to find out how should look your populating code ...

            Cheers!

            1 Reply Last reply
            0
            • S Offline
              S Offline
              shayb
              wrote on last edited by
              #7

              Thanks, but, where can I get reference about getting data to a tree view from an external source rather than internal one?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Skyrpex
                wrote on last edited by
                #8

                You can use "QSettings":http://qt-project.org/doc/qt-5.0/qtcore/qsettings.html to read the .ini file.

                To create and display your tree, you could use "QTreeWidget":http://qt-project.org/doc/qt-5.0/qtwidgets/qtreewidget.html and "QTreeWidgetItem":http://qt-project.org/doc/qt-5.0/qtwidgets/qtreewidgetitem.html..

                Alternatively, you could use "QStandardItemModel":http://qt-project.org/doc/qt-5.0/qtgui/qstandarditemmodel.html, "QStandardItem":http://qt-project.org/doc/qt-5.0/qtgui/qstandarditem.html and "QTreeView":http://qt-project.org/doc/qt-5.0/qtwidgets/qtreeview.html for that purpose.

                Hope it helps!

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  shayb
                  wrote on last edited by
                  #9

                  Thanks for the reply.
                  I am able to read an INI file and write to in by functions I am already femiliar with , and creating views and modifying them BUT from internal sources, where I modify the data inside the program, however I am laking on knowledge with which functions I should use for my purposes...

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    Skyrpex
                    wrote on last edited by
                    #10

                    Could you please be more specific? What do you mean with internal / external sources?

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      shayb
                      wrote on last edited by
                      #11

                      Internal- meaning the data comes from inside the program.
                      External - the data comes from a file - in my case a configuration file (.ini)
                      The main difference is that the data ain't defined within the program but comes from an external source.

                      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