Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, August 2006
Java Crashed


Message 1 in thread

I've found a way to crash the JVM, using Qt Jambi:

layout.removeItem(layout.itemAt(0));

In my case layout was a QGridLayout attached to a QFrame, and the layout was
empty.  Basicly trying to remove an item from the layout if it doesn't
exist.  

Hope helps

A problem that I have been having is:

while(layout.count() > 0)
            layout.removeItem(layout.itemAt(0));

I am using this to clear the layout to add different widgets.  In this case
The layout contains labels and spinboxes in a QFrame.  The problem is if
there
there is content one spinbox always stays behind.  Always.  And it is no
longer
in the grid but thinks it is the only widget and over sizes itseft, beyond
the size of the QFrame, even after adding new widgets.  However the frame
acts
as if there are no widget (before adding more widgets).

Please help, I'm lost in the woods...

David

P.S. How do you replace a layout manager for a widget.  Docs say delete the
first one but how in Java?


Message 2 in thread

blackdragon@xxxxxxxxxxxxxxxxxx wrote:

>while(layout.count() > 0)
>            layout.removeItem(layout.itemAt(0));
>
>I am using this to clear the layout to add different widgets.  [...]
>
>Please help, I'm lost in the woods...
>  
>
A more convenient way of achieving this might be to use the class 
QStackedWidget:

    http://doc.trolltech.com/qtjambi-1.0/qstackedwidget.html

>P.S. How do you replace a layout manager for a widget.  Docs say delete the
>first one but how in Java?
>
>  
>
Executing the following code inside a widget will delete its current 
layout and remove it.

        if (layout() != null)   
            layout().dispose();

Note, though, that references you might have to this layout will at this 
point become unusable. I would rather recommend that you use 
QStackedWidget for your purposes :-)

I hope this helped!

-- Eskil