[Qt-interest] remove QSplitter children / disable splitterdragging.

Eric Clark eclark at ara.com
Tue Oct 27 15:37:27 CET 2009


I ran into this exact problem in my application. I also sent messages to the message board trying to figure out how to remove the widget without deleting it and the responses I got were to delete the widget and it sounded as if the guys at Qt did not see this as a problem. As a result, I had to write my own splitter widget to handle what I needed to do. I was also creating an infinitely splittable widget in any direction. So, you can click inside one widget and choose to split that widget either horizontally or vertically and a splitter would be added in the appropriate direction and a new widget would be created to populate the other side of the splitter.

I would like to point out that you will most likely have to do the same because the guys at trolltech/nokia do not seem to think that it is important to be able to remove widgets from a splitter without deleting them. I totally agree with you though. Why have an addWidget if there is no removeWidget? They do this exact same thing in the QTabWidget class when you add tabs, you can easily remove a tab without deleting it. These are very similar widgets and work similarly, why not have the same functionality in both?

Eric

> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of Constantin Makshin
> Sent: Tuesday, October 27, 2009 3:40 AM
> To: Qt Interest
> Subject: Re: [Qt-interest] remove QSplitter children / disable
> splitterdragging.
> 
> Instead of deleting the widget you'll need to show later again, you may
> hide it.
> 
> On Tue, 27 Oct 2009 11:07:17 +0300, Thomi Richards <thomir at gmail.com>
> wrote:
> > Hi,
> >
> > 2009/10/26 Ben Swerts <benswerts at telenet.be>:
> >>
> >> I didn't follow this thread from the beginning but you can just
> delete
> >> the
> >> required widget in the splitter, i.e. 'widget->deleteLater()' or
> >> similar.
> >>
> >
> > Well, yes, but I don't want to delete the widget - I'll need it
> again.
> > It seems silly to have to continually delete and re-add the widget.
> >
> >
> > It looks from your replies like I'll end up writing my own.
> >
> > Cheers,
> 
> --
> Constantin Makshin
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list