[Qt-interest] remove buttons from a QVBoxLayout
Tamas Nagy
ngy_tms at yahoo.com
Mon May 17 10:12:29 CEST 2010
Hello,
It says QVBoxLayout has no member named takeFirst().
I check takeAt(i) for null, but it crashes too.
Tamas
> --- On Mon, 5/17/10, Rohan McGovern <rohan.mcgovern at NOKIA.COM>
> wrote:
>
> > From: Rohan McGovern <rohan.mcgovern at NOKIA.COM>
> > Subject: Re: [Qt-interest] remove buttons from a
> QVBoxLayout
> > To: qt-interest at trolltech.com
> > Cc: "ext Tamas Nagy" <ngy_tms at yahoo.com>,
> "william.crocker at analog.com"
> <william.crocker at analog.com>
> > Date: Monday, May 17, 2010, 9:44 AM
> > On Monday 17 May 2010, Rohan McGovern
> > wrote:
> > > On Monday 17 May 2010, ext Tamas Nagy wrote:
> > > > Hello!
> > > >
> > > > It compiles, but it causes segmentation
> fault.
> > > >
> > > > for(int i = 0; i <
> verticalbox->count();
> > i++)
> > > >
> >
> verticalbox->takeAt(i)->widget()->setVisible(false);
> > >
> > > That code is wrong... you're removing items from
> the
> > list while
> > > iterating over it. You want something more
> > like:
> > >
> > > while (verticalbox->count()) {
> > >
> > verticalbox->takeFirst()->...
> > > }
> >
> > I didn't read the next lines of the message where you
> had
> > something
> > just like this :-)
> >
> > You also shouldn't use the return value of widget()
> without
> > checking
> > for 0 first.
> >
> > --
> > Rohan
> >
>
>
>
>
More information about the Qt-interest-old
mailing list