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. Using large data structure for storage!
QtWS25 Last Chance

Using large data structure for storage!

Scheduled Pinned Locked Moved Solved General and Desktop
qstringlistmax size
22 Posts 2 Posters 8.1k Views
  • 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.
  • K Offline
    K Offline
    Kushan
    wrote on 18 Oct 2017, 03:57 last edited by Kushan
    #1

    In my qt c++ I am Using QList<QStringList> data structure to store a set of lists! But when I try to put a large number of QStringLists(each QStringList is also bit large in size) such as 100 it give a run time error! What is the best solution for this?

    J 1 Reply Last reply 18 Oct 2017, 04:28
    0
    • K Kushan
      18 Oct 2017, 03:57

      In my qt c++ I am Using QList<QStringList> data structure to store a set of lists! But when I try to put a large number of QStringLists(each QStringList is also bit large in size) such as 100 it give a run time error! What is the best solution for this?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 18 Oct 2017, 04:28 last edited by
      #2

      @Kushan What is the runtime error?
      How big are all these strings together?
      How do you add the strings to the list (can you show the code)?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      K 1 Reply Last reply 18 Oct 2017, 04:37
      0
      • J jsulm
        18 Oct 2017, 04:28

        @Kushan What is the runtime error?
        How big are all these strings together?
        How do you add the strings to the list (can you show the code)?

        K Offline
        K Offline
        Kushan
        wrote on 18 Oct 2017, 04:37 last edited by
        #3

        @jsulm Single QStringList is created and an index values is incremented and fed into a QList<QStringList>

        J 1 Reply Last reply 18 Oct 2017, 04:39
        0
        • K Kushan
          18 Oct 2017, 04:37

          @jsulm Single QStringList is created and an index values is incremented and fed into a QList<QStringList>

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 18 Oct 2017, 04:39 last edited by jsulm
          #4

          @Kushan Sorry, but this does not answer any of my questions!
          If you want to get a solution you should provide enough information.
          So:

          1. What runtime error do you get?
          2. How big are all these strings together?
          3. How exactly do you add strings to the list (please show your code)?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          K 1 Reply Last reply 18 Oct 2017, 05:05
          1
          • J jsulm
            18 Oct 2017, 04:39

            @Kushan Sorry, but this does not answer any of my questions!
            If you want to get a solution you should provide enough information.
            So:

            1. What runtime error do you get?
            2. How big are all these strings together?
            3. How exactly do you add strings to the list (please show your code)?
            K Offline
            K Offline
            Kushan
            wrote on 18 Oct 2017, 05:05 last edited by Kushan
            #5

            @jsulm Code is extremely complex bro! I doubt using QVector instead of QList will solve my size issue

            J 1 Reply Last reply 18 Oct 2017, 05:07
            0
            • K Kushan
              18 Oct 2017, 05:05

              @jsulm Code is extremely complex bro! I doubt using QVector instead of QList will solve my size issue

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 18 Oct 2017, 05:07 last edited by
              #6

              @Kushan I don't ask for the whole project. You should at least be able to say what the runtime error is and how big all those strings are. Did you try to debug your app to see where exactly it crashes?
              Seriously, you really expect to get a solution without providing any information?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              K 1 Reply Last reply 18 Oct 2017, 05:16
              0
              • J jsulm
                18 Oct 2017, 05:07

                @Kushan I don't ask for the whole project. You should at least be able to say what the runtime error is and how big all those strings are. Did you try to debug your app to see where exactly it crashes?
                Seriously, you really expect to get a solution without providing any information?

                K Offline
                K Offline
                Kushan
                wrote on 18 Oct 2017, 05:16 last edited by
                #7

                @jsulm
                1)the error is "This application has requested runtime to terminate it in an unusual way!"
                2)I will give part of a code-
                QList<QStringList> sample;

                QStringList List;

                List="Testing";

                for(int i=0;i<number;i++){
                sample<<List;
                }

                Here number refers to the value entered through line edit(i.e 100 in my scenario)

                J 1 Reply Last reply 18 Oct 2017, 05:21
                0
                • K Kushan
                  18 Oct 2017, 05:16

                  @jsulm
                  1)the error is "This application has requested runtime to terminate it in an unusual way!"
                  2)I will give part of a code-
                  QList<QStringList> sample;

                  QStringList List;

                  List="Testing";

                  for(int i=0;i<number;i++){
                  sample<<List;
                  }

                  Here number refers to the value entered through line edit(i.e 100 in my scenario)

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 18 Oct 2017, 05:21 last edited by
                  #8

                  @Kushan This code isn't going to compile as "List="Testing";" is invalid.
                  Would be nice if you would post part of your real code or at least a sample code which you tested and verified that it is crashing.
                  Did you try to debug your app to see where exactly it is crashing? This is first thing to do in such a situation.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  K 1 Reply Last reply 18 Oct 2017, 05:26
                  1
                  • J jsulm
                    18 Oct 2017, 05:21

                    @Kushan This code isn't going to compile as "List="Testing";" is invalid.
                    Would be nice if you would post part of your real code or at least a sample code which you tested and verified that it is crashing.
                    Did you try to debug your app to see where exactly it is crashing? This is first thing to do in such a situation.

                    K Offline
                    K Offline
                    Kushan
                    wrote on 18 Oct 2017, 05:26 last edited by Kushan
                    #9

                    @jsulm

                    Sorry I made a mistake(The above mentioned error still exists;) the code is

                    QList<QStringList> sample;
                    QString Test="Testing";
                    QStringList List;

                    for(int i=0;i<number;i++){
                    List<<Test;
                    }

                    for(int i=0;i<number;i++){
                    sample<<List;
                    }

                    J 1 Reply Last reply 18 Oct 2017, 05:29
                    0
                    • K Kushan
                      18 Oct 2017, 05:26

                      @jsulm

                      Sorry I made a mistake(The above mentioned error still exists;) the code is

                      QList<QStringList> sample;
                      QString Test="Testing";
                      QStringList List;

                      for(int i=0;i<number;i++){
                      List<<Test;
                      }

                      for(int i=0;i<number;i++){
                      sample<<List;
                      }

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 18 Oct 2017, 05:29 last edited by jsulm
                      #10

                      @Kushan I tested this code: it does not crash (and I don't see why it should).
                      As I said you should first debug to see where it actually crashes.
                      And you still did not say how big your strings are. If they are huge then maybe your app gets out of memory and is terminated by the OS.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      K 1 Reply Last reply 18 Oct 2017, 05:32
                      0
                      • J jsulm
                        18 Oct 2017, 05:29

                        @Kushan I tested this code: it does not crash (and I don't see why it should).
                        As I said you should first debug to see where it actually crashes.
                        And you still did not say how big your strings are. If they are huge then maybe your app gets out of memory and is terminated by the OS.

                        K Offline
                        K Offline
                        Kushan
                        wrote on 18 Oct 2017, 05:32 last edited by
                        #11

                        @jsulm No this is just a sample the actual QString is very long :(

                        J 1 Reply Last reply 18 Oct 2017, 05:37
                        0
                        • K Kushan
                          18 Oct 2017, 05:32

                          @jsulm No this is just a sample the actual QString is very long :(

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 18 Oct 2017, 05:37 last edited by
                          #12

                          @Kushan How long?

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          K 1 Reply Last reply 18 Oct 2017, 05:50
                          0
                          • J jsulm
                            18 Oct 2017, 05:37

                            @Kushan How long?

                            K Offline
                            K Offline
                            Kushan
                            wrote on 18 Oct 2017, 05:50 last edited by
                            #13

                            @jsulm actually
                            QString Test="New,0,0,Instrument1,Order,Buy,100,Amend, Quote"

                            J 1 Reply Last reply 18 Oct 2017, 05:52
                            0
                            • K Kushan
                              18 Oct 2017, 05:50

                              @jsulm actually
                              QString Test="New,0,0,Instrument1,Order,Buy,100,Amend, Quote"

                              J Offline
                              J Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 18 Oct 2017, 05:52 last edited by
                              #14

                              @Kushan That's not long.
                              Please debug you app to see where it is crashing. I'm out of ideas as the code you posted doesn't crash and there is not enough information to tell you why your app is crashing.

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              K 1 Reply Last reply 18 Oct 2017, 05:55
                              0
                              • J jsulm
                                18 Oct 2017, 05:52

                                @Kushan That's not long.
                                Please debug you app to see where it is crashing. I'm out of ideas as the code you posted doesn't crash and there is not enough information to tell you why your app is crashing.

                                K Offline
                                K Offline
                                Kushan
                                wrote on 18 Oct 2017, 05:55 last edited by
                                #15

                                @jsulm Thanx alot how to use the debug?

                                J 1 Reply Last reply 18 Oct 2017, 05:56
                                0
                                • K Kushan
                                  18 Oct 2017, 05:55

                                  @jsulm Thanx alot how to use the debug?

                                  J Offline
                                  J Offline
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on 18 Oct 2017, 05:56 last edited by
                                  #16

                                  @Kushan Take a look at http://doc.qt.io/qtcreator/creator-debugging-example.html
                                  and http://doc.qt.io/qtcreator/creator-debugging.html

                                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  K 1 Reply Last reply 18 Oct 2017, 06:01
                                  2
                                  • J jsulm
                                    18 Oct 2017, 05:56

                                    @Kushan Take a look at http://doc.qt.io/qtcreator/creator-debugging-example.html
                                    and http://doc.qt.io/qtcreator/creator-debugging.html

                                    K Offline
                                    K Offline
                                    Kushan
                                    wrote on 18 Oct 2017, 06:01 last edited by
                                    #17

                                    @jsulm Thanx for sparing your time

                                    J 1 Reply Last reply 18 Oct 2017, 06:01
                                    0
                                    • K Kushan
                                      18 Oct 2017, 06:01

                                      @jsulm Thanx for sparing your time

                                      J Offline
                                      J Offline
                                      jsulm
                                      Lifetime Qt Champion
                                      wrote on 18 Oct 2017, 06:01 last edited by
                                      #18

                                      @Kushan No problem

                                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      K 1 Reply Last reply 18 Oct 2017, 06:13
                                      0
                                      • J jsulm
                                        18 Oct 2017, 06:01

                                        @Kushan No problem

                                        K Offline
                                        K Offline
                                        Kushan
                                        wrote on 18 Oct 2017, 06:13 last edited by
                                        #19

                                        @jsulm Actually the error is indexout of bound but I havent declared any size anywhere in my code for all the structures I have used!

                                        J 1 Reply Last reply 18 Oct 2017, 06:15
                                        1
                                        • K Kushan
                                          18 Oct 2017, 06:13

                                          @jsulm Actually the error is indexout of bound but I havent declared any size anywhere in my code for all the structures I have used!

                                          J Offline
                                          J Offline
                                          jsulm
                                          Lifetime Qt Champion
                                          wrote on 18 Oct 2017, 06:15 last edited by
                                          #20

                                          @Kushan Are you accessing list elements using [] anywhere in your code like

                                          QList<QString> list;
                                          qDebug() <<list[0];
                                          

                                          ?

                                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          K 2 Replies Last reply 18 Oct 2017, 06:20
                                          0

                                          1/22

                                          18 Oct 2017, 03:57

                                          • Login

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