Results 1 to 4 of 4

Thread: Move QtLayout with child widgets

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jul 2014
    Location
    Germany
    Posts
    14
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    3

    Default Re: Move QtLayout with child widgets

    Hello!

    The code compiles and there is no error during execution.
    Here some code:

    Qt Code:
    1. QGridLayout* const glayout = dynamic_cast<QGridLayout*>(form->layout());
    2. if (glayout)
    3. {
    4. QLayoutItem* const last_item = glayout->itemAtPosition(glayout->rowCount()-1, 0);
    5.  
    6. if (last_item && dynamic_cast<QHBoxLayout*>(last_item))
    7. {
    8. qDebug() << "Moving...";
    9. glayout->removeItem(last_item);
    10. ui->verticalLayout_frame_edit->insertItem(1, last_item);
    11. }
    12. }
    13. }
    To copy to clipboard, switch view to plain text mode 

    Should this be enough to move the layout with all its children or do I have to do something special
    to move the children too?

    And I tried several "update()" calls...

    Regards
    Sven
    Last edited by SvenA; 17th June 2019 at 11:08.

Similar Threads

  1. Replies: 1
    Last Post: 17th December 2018, 13:18
  2. Implicitly move child widgets *on their own.*
    By tescrin in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2012, 18:22
  3. Child widgets
    By poporacer in forum Newbie
    Replies: 6
    Last Post: 12th August 2010, 04:04
  4. Replies: 5
    Last Post: 19th April 2010, 00:31
  5. Child widget does not move along with its parent
    By starch in forum Qt Programming
    Replies: 8
    Last Post: 9th July 2009, 13: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
  •  
Qt is a trademark of The Qt Company.