Results 1 to 5 of 5

Thread: old layout item remain on widget

  1. #1
    Join Date
    Mar 2011
    Posts
    20
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question old layout item remain on widget

    hello everyone ,
    i've got some problem about change the layout item's.
    i'm using : qt 4.7 in winidows xp sp3

    i made a simple program , with 2 button's change a mainLayout item
    the item compositing by several label , and i put some word in corner ,
    after change layout (from 4 label to 2 label) some word still exist on window
    and part of button covered by the old label .

    i put whole project and picture in attachments , any suggestion would be appreciate

    thanks
    and sorry for my poor english
    ---------
    another problem is after i delete the layout item
    i always got the following msg , but everything keep going
    QCoreApplication:: postEvent: Unexpected null receiver
    QLayout::addChildLayout: layout "" already has a parent
    code about delete layout item
    Qt Code:
    1. QLayoutItem *child;
    2. while ((child = mainLayout->takeAt(0)) != 0) {
    3. child->widget()->deleteLater();
    4. }
    5. delete child;
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by lllturtle; 25th March 2011 at 10:08. Reason: add a normal picture

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: old layout item remain on widget

    hi,
    after change layout (from 4 label to 2 label) some word still exist on window
    and part of button covered by the old label .
    I'm not sure what you are asking, but if you have problems in removing the widgets in layout,
    try
    Qt Code:
    1. void QLayout::removeWidget ( QWidget * widget )
    To copy to clipboard, switch view to plain text mode 
    .
    this will remove the added widget.
    i put whole project and picture in attachments , any suggestion would be appreciate
    The attachment is 3kb so cant read the files.

    bala

  3. #3
    Join Date
    Mar 2011
    Posts
    20
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: old layout item remain on widget

    Hi bala ,
    thank's for your reply ,
    actually i need to remove layout , because i use two part of layouts(the button layout and label layout) combine to one
    and i've already try to remove item
    Qt Code:
    1. mainLayout->removeItem(child);
    To copy to clipboard, switch view to plain text mode 
    but seems the same result .

    The attachment is 3kb so cant read the files.
    i've test download the file ,and unzip file , use qt open and compile ,
    it should be ok!

  4. #4
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: old layout item remain on widget

    hi lllturtle,
    i've test download the file ,and unzip file , use qt open and compile ,
    it should be ok!
    apologies i downloaded in windows. in linux its working fine.

    can u explain what u want to acheive when u press two button?

    bala

  5. #5
    Join Date
    Mar 2011
    Posts
    20
    Thanks
    6
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: old layout item remain on widget

    hi bala ,
    can u explain what u want to acheive when u press two button?
    when the "one" button pressed : i put 2 label to print on top left corner and bottom right corner ,add into vertical layout
    "two" button pressed : i put 4 label just like one , but the label height shrink , i've past some pic's on first post ,it can distinct clearly
    the problem is when i chenge the label , the old label didn't clear somewhere .

Similar Threads

  1. Hiding Layout item - Layout does not use available space
    By Asperamanca in forum Qt Programming
    Replies: 0
    Last Post: 27th January 2011, 10:51
  2. mainwindow layout vs widget layout
    By fatecasino in forum Newbie
    Replies: 2
    Last Post: 14th December 2010, 15:45
  3. How to resize a layout item?
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 22nd February 2009, 09:53
  4. QMenu: remain visible while mouseOver
    By vonCZ in forum Newbie
    Replies: 10
    Last Post: 25th October 2007, 17:54
  5. Replies: 14
    Last Post: 9th November 2006, 09:35

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.