[Qt-jambi-interest] [Resolved] RE: Subclassing QLayout & QNoNativeResourcesException
Frank Bergmann
fbergman at u.washington.edu
Fri Dec 11 18:59:19 CET 2009
Thank you so much for the example. I'm actually working on a port of Qwt for
C#. And I felt bad posting C# code to what essentially is a java list.
Anyway, I just ported over your example and it works just fine, so at least
I now know that the problem is not the subclassing of the layout. After
seeing your example I added a new method to my layout:
public void addWidget(QWidget widget, int magic)
{
addChildWidget(widget);
addItem(new QWidgetItem(widget));
}
And this magically resolved all my issues. I still think it should not have
been necessary though.
Anyway ... thanks again
Frank
> -----Original Message-----
> From: qt-jambi-interest-bounces at trolltech.com [mailto:qt-jambi-interest-
> bounces at trolltech.com] On Behalf Of Lists
> Sent: Thursday, December 10, 2009 4:54 AM
> To: qt-jambi-interest at trolltech.com
> Subject: Re: [Qt-jambi-interest] Subclassing QLayout &
> QNoNativeResourcesException
>
> Hi!
>
> It's hard to find an error without posting your code :)
>
>
> Attached you can find a BorderLayout implementation.
>
> It's part of the QT implementation from the JVx Enterprise Application
> Framework.
>
> It's still in development, but it's open source (Apache 2.0 licence) and
> maybe the class will help you as template?
>
> The referenced classes are not included, but i think that's not a problem
for
> you.
>
>
> > -----Ursprüngliche Nachricht-----
> > Von: qt-jambi-interest-bounces at trolltech.com
> > [mailto:qt-jambi-interest- bounces at trolltech.com] Im Auftrag von Frank
> > Bergmann
> > Gesendet: Donnerstag, 10. Dezember 2009 01:28
> > An: qt-jambi-interest at trolltech.com
> > Betreff: [Qt-jambi-interest] Subclassing QLayout &
> > QNoNativeResourcesException
> >
> > Hello,
> >
> > I had to implement a custom Layout but somehow things just don't work
> > as planned, directly after adding an item to the layout, like so:
> >
> > contentsWidget.layout().addWidget(legendItem);
> >
> > and verifying by debugging addItem(QLayoutItemInterface item), that
> > everything is fine on my end (I even made sure that itemAt(index)
> > within my Layout class would return the right thing). However as soon
> > as the addWidget call completes, I'm in trouble:
> >
> > contentsWidget.layout().itemAt(0).widget()
> >
> > returns with a com.trolltech.qt.QNoNativeResourcesException. (And that
> > even though my legendItem is still just fine.) The message that I get
> > is:
> >
> > "Function call on incomplete object of type:
> > com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper"
> >
> > Which is not at all helpful. As final straw I turned to the
> > documentation:
> >
> > http://qt.nokia.com/doc/qtjambi-4.5.2_01/index.html
> >
> > which hints at implementations of a BorderLayout and FlowLayout
> > example, however
> >
> > http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/layouts-
> > borderlayo
> > ut.html
> > http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/layouts-
> > flowlayout
> > .html
> >
> > both are not very informative. I hope I can find some clues here,
> >
> > cheers
> > Frank
> >
> > _______________________________________________
> > Qt-jambi-interest mailing list
> > Qt-jambi-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
More information about the Qt-jambi-interest
mailing list