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. delete gridlayout and its widget
Qt 6.11 is out! See what's new in the release blog

delete gridlayout and its widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 885 Views 2 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.
  • A Offline
    A Offline
    Asid
    wrote on last edited by
    #1

    please sad to me how can i delete my gridlayout

    raven-worxR 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean the Qt Quick type ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Asid

        please sad to me how can i delete my gridlayout

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by raven-worx
        #3

        @Asid
        something like this?

        void clearLayout( QLayout* layout )
        {
            QLayoutItem* item = Q_NULLPTR;
            while( (item = layout->takeAt(0)) )
            {
                if (item->layout())
                {
                    clearLayout( item->layout() );
                    delete item->layout();
                }
                else if ( item->widget() )
                    delete item->widget();
                else if( item->spacerItem() )
                    delete item->spacerItem();
        
                delete item;
            }
        }
        
        QWidget* widgetWithGridLayout = ...;
        QGridLayout* gridLayout = ....;
        clearLayout( gridLayout );
        delete gridLayout;
        delete widgetWithGridLayout;
        

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved