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. Change items in a container (e.g. QList)

Change items in a container (e.g. QList)

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 3 Posters 3.8k 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.
  • M Offline
    M Offline
    Maser
    wrote on last edited by Maser
    #10

    So this means if i have my class derived from QObject, i can only store them as pointers like QList<MyClass *> *list or QList<MyClass *> list ?

    mrjjM 1 Reply Last reply
    1
    • M Maser

      So this means if i have my class derived from QObject, i can only store them as pointers like QList<MyClass *> *list or QList<MyClass *> list ?

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #11

      @Maser
      yes correct.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Maser
        wrote on last edited by
        #12

        A, thanks! One more mystery solved)) I already wondered why when i wanted add to MyClass the abilities from QObject something crash down in my program, so i made some workarounds)

        mrjjM 1 Reply Last reply
        0
        • M Maser

          A, thanks! One more mystery solved)) I already wondered why when i wanted add to MyClass the abilities from QObject something crash down in my program, so i made some workarounds)

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #13

          Also, just as note.
          Most QWidgets takes a parent (another qwidget) in constructor.
          It means the parent now owns the child and will delete it when it dies it self.

          So if you have childs in a list and give them to parents,
          the list should Not delete the childs as the parent will. :)

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Maser
            wrote on last edited by
            #14

            Ye, i stil havent had time to go into that stuff with smartpointers and all)

            mrjjM 1 Reply Last reply
            0
            • M Maser

              Ye, i stil havent had time to go into that stuff with smartpointers and all)

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #15

              @Maser
              well its not so much smart pointers but more a ownership.
              Must Widgets in Qt can own other widgets and will delete them when deleted.

              So often even you new a Qwidget you dont need to delete it yourself as parent will.

              1 Reply Last reply
              1
              • M Offline
                M Offline
                Maser
                wrote on last edited by
                #16

                Yes, but this is stil related to watching for pointers, if they stil good or deleted somewhere else, doesnt it?

                BTW, why cant i mark the thread solved?

                mrjjM 1 Reply Last reply
                0
                • M Maser

                  Yes, but this is stil related to watching for pointers, if they stil good or deleted somewhere else, doesnt it?

                  BTW, why cant i mark the thread solved?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #17

                  @Maser
                  yes watching pointers is always needed :)

                  • BTW, why cant i mark the thread solved?
                    You might not have asked it as question.
                    On first post look in topic tools button.
                    There is "Ask as Question"
                    Then you can mark it as solved :)
                  1 Reply Last reply
                  1
                  • M Offline
                    M Offline
                    Maser
                    wrote on last edited by
                    #18

                    Tricky) Thanks.

                    mrjjM 1 Reply Last reply
                    0
                    • M Maser

                      Tricky) Thanks.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #19

                      @Maser
                      yes its slightly funky :)

                      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