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. Save QTreeWidget to file
Forum Updated to NodeBB v4.3 + New Features

Save QTreeWidget to file

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 4.7k 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.
  • J Offline
    J Offline
    Jirka
    wrote on last edited by
    #1

    Does there any functions (classes) in QT for saving QTreeWidget object with content into file?

    Problem:
    I have content of tree in external XML file (6Mbytes – passes into process by parameter of command line). Transformation of this file to tree takes more than 1 min on my computer. It is not acceptable for users. Main problem (time consumpion) is not in processing XML file, but in construction of tree. Each second item of tree has 10 columns.

    Idea:
    Save QTreeWidget into file (like in Java) and read it from this one.

    Has anybody any advance please ?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      AFAIK, it's not possible out-of-the-box to stream the QTreeWidget.

      As a productive workaround, consider using raw QTreeView, an fine tune the performance there. It will take a lot of time to code, but then you have full control over creation of the tree, and can optimise. You can also take a look at QTreeView::setUniformRowHeights() (I think QTreeWidget has this method, too). If applicable, it can improve performance not only during tree population, but also during normal usage.

      (Z(:^

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #3

        I don't think that (de)serializing your in-memory data will improve your performance, as obviously creating this in-memory data is your bottleneck (which has to be done either way).

        Take a look at the "Simple DOM Model Example":http://qt-project.org/doc/qt-4.8/itemviews-simpledommodel.html, which explains how to use an XML file (or more specifically a QDomDocument) as an item model (which then can be used with QTreeView).

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jirka
          wrote on last edited by
          #4

          Thank you, Iĺl try it

          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