[PyQt] QT4/QTabWidget tab add/remove/
S James S Stapleton
stapleton at mps.ohio-state.edu
Sun Jun 10 22:46:30 BST 2007
I'm closer to where I want/need to be, but I'm down one step I think.
What function do I override if I want to intercept a tab selection even (in a
I.E. it will be called if a tab is clicked.
On Saturday 09 June 2007 21:18, David Boddie wrote:
> On Sun Jun 10 00:18:35 BST 2007, S James S Stapleton wrote:
> > On Friday 08 June 2007 20:23, S James S Stapleton wrote:
> > > I have a tabwidget in an application where tabs are being added/removed
> > > at runtime, according to loaded data and user commands. The problem is,
> > > that when tabs are added, they appear in the background of the current
> > > tab, as an underlay. If I cycle through the loaded tabs they dissapear.
> > > but that's tedious to do every run while debugging.
> > The files are located here:
> > http://www.thestapletons.org/jim/varapp.tbz
> > If you load up the "creatures.fls" file, using the file->load features
> > option, you'll see the graphical glitches I was talking about.
> There are two types of graphical glitch here: the first is due to the
> delays in processing the data used for each tab; the second is a result of
> the way you've created widgets for use with the tab widget.
> There's not much that can be done about the delays you see when the data
> is loaded unless you ensure that the event loop is periodically run. This
> isn't causing the problems you see, so we won't look at this now.
> The underlay problem is caused when widgets are created with certain
> parents then reparented later. In this case, you create a feature_box
> widget and put it inside a QWidget ("tmp") before passing it (not the
> widget) to addTab().
> Ideally, you should pass the feature_box itself to addTab() but, if each
> feature_box is designed to have a parent widget, you should pass the "tmp"
> QWidget instead. If you do this, you might want to remove the resize
> handling code in feature_box and just place each instance of this class in
> a layout. Even if you just pass "tmp" to addTab(), this will solve the
> underlay effect you reported.
> I also noticed that you create various widgets, and call show() and hide()
> on them at various times. This might be the cause of the blank areas that
> temporarily appear in the main window.
> If you change line 398 of ig_moduleapp.py to
> offset = tabber.addTab(tmp, name)
> does this fix some of the problems you were seeing?
> PyQt mailing list PyQt at riverbankcomputing.com
More information about the PyQt