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. Which model and item classes should I use to display custom items in a table and in a combo box?
Forum Updated to NodeBB v4.3 + New Features

Which model and item classes should I use to display custom items in a table and in a combo box?

Scheduled Pinned Locked Moved Unsolved General and Desktop
24 Posts 6 Posters 6.0k Views 5 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.
  • Pl45m4P Pl45m4

    @JonB said in Which model and item classes should I use to display custom items in a table and in a combo box?:

    Just don't know what you mean. QSettings is just an example of (effectively external/persistent) storage, if you want to use it to share some data between whatever then you can.

    for sure you can, but in my eyes it's a quite weird approach.

    I personally would use QSettings only for the case, described in the documentation: to store real "settings" for later use in different sessions

    • https://doc.qt.io/qt-5/qsettings.html#details

    As you ( @JonB ) wrote above, if the data is getting bigger, i.e. more than just some "settings", it only makes it more complicated and harder to manage.

    JonBJ Online
    JonBJ Online
    JonB
    wrote on last edited by
    #21

    @Pl45m4 said in Which model and item classes should I use to display custom items in a table and in a combo box?:

    I personally would use QSettings only for the case, described in the documentation: to store real "settings" for later use in different sessions

    I do not disagree with you (=> I agree with you) :) I understand your point now. I thought the OP did want to save for future sessions, e.g.

    I would like to save the device information in the settings store with a QSettings object [...] and written to the settings store.

    But if you are right and the OP does not want storage for future re-use (i.e. only for use within this session) then I would not pick QSettings. If that is the case then in-memory should be adequate, no backing storage.

    Pl45m4P 1 Reply Last reply
    0
    • JonBJ JonB

      @Pl45m4 said in Which model and item classes should I use to display custom items in a table and in a combo box?:

      I personally would use QSettings only for the case, described in the documentation: to store real "settings" for later use in different sessions

      I do not disagree with you (=> I agree with you) :) I understand your point now. I thought the OP did want to save for future sessions, e.g.

      I would like to save the device information in the settings store with a QSettings object [...] and written to the settings store.

      But if you are right and the OP does not want storage for future re-use (i.e. only for use within this session) then I would not pick QSettings. If that is the case then in-memory should be adequate, no backing storage.

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

      @JonB said in Which model and item classes should I use to display custom items in a table and in a combo box?:

      I thought the OP did want to save for future sessions

      Yes, but that became clear later. The initial post sounded like sharing data using QSettings between modules / classes of the same program and session :)
      That's why I asked in my first reply ;-)

      This is the part I am referring to ;-)

      @DL5EU said in Which model and item classes should I use to display custom items in a table and in a combo box?:

      I would like to save the device information in the settings store with a QSettings object (read and write methods exist). When editing is done, I would like to set the values of the settings so that they are available to other objects of the application and written to the settings store.

      "When editing is done.... available to other objects of the app..."

      Sounds a bit like same session and not really a use case for QSettings... ;-)

      @DL5EU don't worry, everything's fine :) you can use QSettings. The situation wasn't really clear to me at first


      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
      1
      • D Offline
        D Offline
        DL5EU
        wrote on last edited by
        #23

        Dear all,

        it seems to me that I really have a lot to learn :-) I must admit that I don't have much experience in OOP, nor in Qt.

        In my application I would like to control measurement instruments (e.g. generators and meters) to measure frequency responses and other things. The device information I am talking about is needed to create the corresponding device objects for the measurement functions. As every instrument has different commands e.g. to set the frequency or read the measured value, I need information concerning the device class (scope, meter, generator,...) the type (34401, 54616, SMY01) and of course the address on the GPIB to open a connection to the instrument. So I have to set up a persistent configuration that is read whenever the application is started. Additionally, this information is or might be needed at different places in the application. Perhaps the settings store is not the right place to store this kind of information, even if it is technically possible.

        Ralf

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

          Looks like you rather need to store that information in some sort of database or configuration file(s).

          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
          • M mpergand referenced this topic on
          • M mpergand referenced this topic on

          • Login

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