Results 1 to 4 of 4

Thread: save and restore TreeWidgetItem

  1. #1
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default save and restore TreeWidgetItem

    Hi,
    Suppose i have a treewidget with a number of QTreeWidgetItem which may or may not have some children (having 2 columns=> text, value) underneath it.
    I want to save these QTreeWidgetItem structure somehow in QList or watever (i dunno hw to do this in qt) and later want to restore it.
    How to do this in Qt.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: save and restore TreeWidgetItem

    What do you mean by "later" ? You want the data to be available next time you start the app, or few minutes "later" during program execution ?

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: save and restore TreeWidgetItem

    You can store them in QList, ans use them later, if you want to use next time the application starts then save into QList, and then save QList to a file or database... or even QSettings can be used

  4. The following 2 users say thank you to Santosh Reddy for this useful post:

    ante (26th August 2011), raj_iv (22nd June 2011)

  5. #4
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt/Embedded Qt Jambi PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: save and restore TreeWidgetItem

    Hi, I use this to refresh file and directory list in my "browse folder" application. I store items opened or selected in a map but there is a problem when I collapse item. The "on_treeWidgetName_itemCollapsed()" private slot of my c++ class are not called (=> closed item is not removed from map).
    Have you any suggestion to solve this?

Similar Threads

  1. Replies: 4
    Last Post: 5th October 2010, 23:47
  2. Save and restore QByteArray in mysql database
    By ruben.rodrigues in forum Newbie
    Replies: 0
    Last Post: 9th August 2010, 10:43
  3. Save & Restore a selection in QTreeWidget
    By youkai in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2008, 20:54
  4. QPainter save() and restore()
    By babu198649 in forum Newbie
    Replies: 4
    Last Post: 28th July 2008, 10:22
  5. QPainter::save and QPAinter::restore()
    By quickNitin in forum Newbie
    Replies: 2
    Last Post: 17th June 2006, 23:11

Tags for this Thread

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.