Results 1 to 4 of 4

Thread: Best way to store and retrieve contents of QTableWidget?

  1. #1
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Best way to store and retrieve contents of QTableWidget?

    What is the best way of saving and restoring the contents of a QTableWidget into QSettings? Saving and restoring every single item would take a while, is there anything else?

    Thanks in advance ~codeslicer

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Best way to store and retrieve contents of QTableWidget?

    You can use a proper model, for example onebased on a stringlist and then save the stringlist to settings. But it will take the same amount of time as storing each item manualy.

  3. The following user says thank you to wysota for this useful post:

    codeslicer (6th April 2008)

  4. #3
    Join Date
    Feb 2008
    Posts
    153
    Thanks
    40
    Thanked 8 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best way to store and retrieve contents of QTableWidget?

    Ok thanks, I was just wandering if there was a way of taking out one huge piece of "data" from the QTableWidget and just stuffing it into QSettings. But I guess I'll just create a parser script which will check a folder in QSettings for any values.

    Thanks again

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Best way to store and retrieve contents of QTableWidget?

    There is no single piece of data in QTableWidget. It consists of separate items. If you had a proper model, you could implement it in such a way that all data would be stored in a list that you could simply redirect to QSettings.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.