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 i delete a QTreeWidgetItem ? just call delete pQTreeWidgetItem; ?
QtWS25 Last Chance

how can i delete a QTreeWidgetItem ? just call delete pQTreeWidgetItem; ?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 2.5k 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by
    #1

    how can i delete a QTreeWidgetItem ?
    just call delete pQTreeWidgetItem; ?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Yes, assuming pQTreeWidgetItem is of type QTreeWidgetItem*.

      O 1 Reply Last reply
      0
      • Malek_KhlifM Offline
        Malek_KhlifM Offline
        Malek_Khlif
        wrote on last edited by
        #3

        use "deleteLater();"

        I Love Qt <3

        O 1 Reply Last reply
        0
        • Malek_KhlifM Malek_Khlif

          use "deleteLater();"

          O Offline
          O Offline
          opengpu2
          wrote on last edited by
          #4

          @Malek_Khlif
          deleteLater is not a member of QTreeWidgetItem...

          1 Reply Last reply
          0
          • Chris KawaC Chris Kawa

            Yes, assuming pQTreeWidgetItem is of type QTreeWidgetItem*.

            O Offline
            O Offline
            opengpu2
            wrote on last edited by
            #5

            @Chris-Kawa should i remove it from the parent widgetitem?

            1 Reply Last reply
            0
            • Malek_KhlifM Offline
              Malek_KhlifM Offline
              Malek_Khlif
              wrote on last edited by
              #6

              juste use deleteLater(); and the Qt wait until the loopevent delete the item.

              I Love Qt <3

              O 1 Reply Last reply
              0
              • Malek_KhlifM Malek_Khlif

                juste use deleteLater(); and the Qt wait until the loopevent delete the item.

                O Offline
                O Offline
                opengpu2
                wrote on last edited by
                #7

                @Chris-Kawa deleteLater is not a member of QTreeWidgetItem...

                1 Reply Last reply
                0
                • Chris KawaC Offline
                  Chris KawaC Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Malek_Khlif QTreeWidgetItem is a value type and is not derived from QObject, thus doesn't have deleteLater() member.

                  @opengpu2 Just delete item;. You don't need to remove it from parent or tree widget. It will be done automatically.

                  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