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. QListWidget removing QListWidgetItems and what it does on memory
Forum Updated to NodeBB v4.3 + New Features

QListWidget removing QListWidgetItems and what it does on memory

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.9k 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.
  • E Offline
    E Offline
    enforcer
    wrote on last edited by
    #1

    In the "QListWidget Reference":http://qt-project.org/doc/qt-5.0/qtwidgets/qlistwidget.html it is said that when functions like QListWidget::clear and the QListWidget destructor are deleting QListWidgetItems from the memory, but what happens when I call

    @QListWidget::removeItemWidget(item);@

    The reference doesn't say anything if the QListWigetItem is deleted from memory or just detached from QListWidget. Can you help me in that point to avoid memory leaks or segmentation faults?

    lg enforcer

    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
      #2

      I don't use Qt5 but it looks like Qt 4.8 sources says it is not deleted from memory.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cincirin
        wrote on last edited by
        #3

        "removeItemWidget":http://qt-project.org/doc/qt-5.0/qtwidgets/qlistwidget.html#removeItemWidget just remove the widget from item previously set with "setItemWidget":http://qt-project.org/doc/qt-5.0/qtwidgets/qlistwidget.html#setItemWidget and not delete the widget. If you want to remove an item from list, just delete it, or "takeItem":http://qt-project.org/doc/qt-5.0/qtwidgets/qlistwidget.html#takeItem, but then you'll need to manually destroy 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