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. Remove widgets from QVBoxLayout [SOLVED]
QtWS25 Last Chance

Remove widgets from QVBoxLayout [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 12.2k 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.
  • A Offline
    A Offline
    agiorla
    wrote on last edited by
    #1

    Dear all

    I have some (small) issues with the QVBoxLayout.

    I have a list of input lines ordered in a QVBoxLayout. I have buttons to add lines (which works perfectly fine), and buttons to remove lines. When there are only 2 or 3 lines, the lines don't disappear in the widget. They are desactivated, but they remain visible, and overlap with the active lines. Maybe a picture will explain better than me, so here is a screenshot. On the left: the window after adding 3 lines, and on the right, the window after removing 2 lines using the takeAt(int) method.

    !http://img28.imageshack.us/img28/4871/screenshotqxm.png(screenshot)!

    Is there any way to clean the widget ? I have looked, but I didn't find any clearLyout() method or anything similar. update() of the layout or the widget does not work either.

    Thanks for the advice !

    Alain

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kxyu
      wrote on last edited by
      #2

      That issued was discussed maybe a hundred times here. The thing is, that you should not only remove your widgets from layout, but actually delete them.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        p-himik
        wrote on last edited by
        #3

        If you use removeItem() or removeWidget() than you have to delete widget manually. As docs say:

        bq. It is the caller's responsibility to delete the item.

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

          It indeed works. Thanks a lot !

          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