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. How can we handle large files in qt?
Forum Updated to NodeBB v4.3 + New Features

How can we handle large files in qt?

Scheduled Pinned Locked Moved General and Desktop
9 Posts 5 Posters 7.1k 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.
  • A Offline
    A Offline
    aurora
    wrote on last edited by
    #1

    Is there any good way for handling text files of hundred of bytes?
    If there any such please tell me...

    I my GUI program, i need to read very large files (around 200MB..!!!) and need to perform search operation on that...
    I am reading line by line and displaying them in QTableWidget but as the file size increases, program crashes or hangs....what should i do, in this case?
    How can i load such big files in QTableWidget?
    How can i perform searching efficiently on them?
    Does Qt provides any good mechanism for these kind of problems?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on last edited by
      #2

      I've never tried to work with such large files. But maybe it's worth a try with ModelView architecture. QTableView and QStandardItemModel(or some other models or write your own model).

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

        If you really have to handle large amounts of data and you want your application to be conservative memory wise you should probably implement your own QAIM which supports streaming and caching.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          Memory-mapping the file would be a start, I guess. In no case, try to load it all in one go. Also note that depending on the encoding of the original file, your memory consumption can be quite a bit higher than just the size of the original file. Still, 200MB should be doable. It is not that big.

          1 Reply Last reply
          0
          • ? This user is from outside of this forum
            ? This user is from outside of this forum
            Guest
            wrote on last edited by
            #5

            Hi aurora,
            You can use qsql for this issue and it is more efficient to manipulate data like retrieving, searching. refer this link i think it will help for u http://developer.qt.nokia.com/doc/qt-4.8/qsqlquery.html

            1 Reply Last reply
            0
            • A Offline
              A Offline
              aurora
              wrote on last edited by
              #6

              Thank u all for your valuable suggestion, i'll go through all the alternatives that u specified and come back to if there is any more problem

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                [quote author="cdeepak" date="1329191204"]Hi aurora,
                You can use qsql for this issue and it is more efficient to manipulate data like retrieving, searching. refer this link i think it will help for u http://developer.qt.nokia.com/doc/qt-4.8/qsqlquery.html[/quote]

                That would really depend on the kind of data you are manipulating, and the input format you have been given to work with. If your data is suitable for this: by all means, use it, but not all data is. Putting a huge text file in a database for instance doesn't really work.

                1 Reply Last reply
                0
                • ? This user is from outside of this forum
                  ? This user is from outside of this forum
                  Guest
                  wrote on last edited by
                  #8

                  yes, Of course Andre is right. if your data is suitable u can use this.

                  1 Reply Last reply
                  0
                  • deisikD Offline
                    deisikD Offline
                    deisik
                    wrote on last edited by
                    #9

                    [quote author="aurora" date="1329131080"]I am reading line by line and displaying them in QTableWidget but as the file size increases, program crashes or hangs….what should i do, in this case? How can i load such big files in QTableWidget?[/quote]

                    No way. Possibly you could try QTableView but your mileage may vary

                    [quote author="aurora" date="1329131080"]How can i perform searching efficiently on them?[/quote]

                    You should build something like a binary search tree on the data

                    [quote author="aurora" date="1329131080"]Does Qt provides any good mechanism for these kind of problems? [/quote]

                    The cruel answer is no, qt won't help you in any of these problems. You should rely only on your sheer C/C++ skills in such questions if you want to create something workable. In short, you will have to write your own file engine or use an existing one to work directly off disk (relational DBMS won't help you either). And probably you will have to exclude qt from everything that deals with large datasets. For sure somebody will get up here and point a finger at me but before blowing fire read "this":http://bugreports.qt-project.org/browse/QTBUG-18490

                    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