[PATCH] KJanusWidget compatibility with QTabWidget

Simon Hausmann hausmann at kde.org
Fri Nov 22 10:27:08 GMT 2002


On Thu, Nov 21, 2002 at 02:42:03PM -0500, Ravikiran Rajagopal wrote:
> Hello,
>   Currently, the only way to remove a page from KJanusWidget is to actually 
> delete it. This is undesirable for two reasons:
> 
> 1. The widget may need to be reused. In particular, one may want to switch 
> from IconList view or Tab view to TreeList view when the number of pages 
> becomes large (primary reason for existence of KJanusWidget). One would then 
> want to decouple all pages from the current KJanusWidget, create a new one 
> with a different view, and reattach all pages. This is even more important if 
> the page widgets are dynamically generated.
> 
> 2. KJanusWidget essentially provides a nicer QTabWidget, and there is no 
> analogue of QTabWidget::removePage() which is extremely useful.
> 
> Since the code for removing a page from KJanusWidget already exists in its 
> implementation, it is easy to create a new member function. Please see the 
> attached diff. My only qualm is in actually making the new removePage() 
> function public, but I don't see why not since the widget can be deleted in 
> public. This also fixes a crash with Qt >= 3.1 reported earlier. (I am not 
> the only person experiencing this crash; Pavel Troller patrol at sinus.cz does 
> too.)
> 
> Could someone please take a look at this? If this patch is not acceptable, I 
> would greatly appreciate an explanation. AFAICS, the patch is binary 
> compatible.

Your patch looks good IMHO, except for one thing: I think removePage
should take a bare QWidget pointer, not a const one.

One the subject of that crash you experienced, with QTabWidget: Do
you happen to have a testcase?

Simon




More information about the kde-core-devel mailing list