[PyKDE] Re: tab creation or khtml part crashing

Andreas Pakulat apaku at gmx.de
Mon Dec 18 17:38:03 GMT 2006


On 18.12.06 11:27:23, Marcos Dione wrote:
> On Mon, Dec 18, 2006 at 11:16:19AM +0100, Andreas Pakulat wrote:
> > On 18.12.06 02:44:42, Marcos Dione wrote:
> > >     answering myself, again: forget about KHTMLView altogether. the
> > > problem was like this:
> > > 
> > > * QTabWidget.addTab() only accepts QWidgets. KHTMLPart is not.
> > > * QVBoxLayout is not a QWidget, so create one and use it as the layout
> > >   parent.
> > > * QVBoxLayout is not a QWidget, so you cannot use it as a KHTMLPart 
> > >   parentWidget. so, add the KHTMLView.
> > > 
> > >     all this got fixed using only a splitter. here's the final code:
> > > 
> > > tab= QSplitter (self.tabMaster)
> > > htmlView= KHTMLPart (tab, None, self)
> > > htmlView.openURL (url)
> > > self.tabMaster.addTab (tab, url.url ())
> > 
> > The right thing would be a plain QWidget, with a layout set on it and
> > you could use that as parent&paretnWidget.
> 
>     well, as I said, you can't use a layout as a khtmlpart parentWidget
> because is not a qwidget

How about QVBox?

> and as khtmlpart is neither a qwidget, you
> can't addWidget() it to a layout.

Right, khtmlpart is a KPart, which _has_ a widget. The KHTMLPart uses
the parentWidget and adds its own widget into that parent widget, so as
long as you set a layout onto a QWidget and provide that QWidget into
KHTMLParts constructor you're fine.

Then all you need to do is set this QWidget as tab content.

If that doesn't work for you there's something wrong, please provide a
small complete example that reproduces the problem so we can have a
look.

Andreas

-- 
After your lover has gone you will still have PEANUT BUTTER!




More information about the PyQt mailing list