Results 1 to 2 of 2

Thread: Delete a QGridLayout and New QGridLayout at runtime

  1. #1
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Delete a QGridLayout and New QGridLayout at runtime

    Hi,
    I have a QGridLayout in my program. In a function I create it like this,
    SnapLayout = new QGridLayout(this);
    in that function I create some QLabel and add some that to SnapLayout like this,

    SnapLayout->addWidget(pixmapLabels[i][j], i + 1, j + 1 )

    At run time I call this function, when i click on a button. The brobs is that at first time ( loading time ) no error display and that function is working. But when I try to call this function, a message display like this,
    QLayout: Attempting to add QLayout "" to CImageView "", which already has a layout

    First time it display all the QLabel and at the second time it display the old QLabels only,
    Didn't display the new one.
    How can I solve this probs?
    Please help me

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Delete a QGridLayout and New QGridLayout at runtime

    Either delete the old layout before applying the new one or reuse the old layout replacing widgets instead of creating the new layout.

  3. The following user says thank you to wysota for this useful post:

    sabeesh (6th November 2007)

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.