Hi,

How stupied one can be :-) I didn't pass the parent when creating the
child widgets.

Tom

Tom Schindl schrieb:
> Hi,
> 
> On the weekend I tried to write some custom layouts to match layouts I
> already know from SWT but I'm somehow failing miserably.
> 
> Problem 1: The time of setting the layout to a QWidget
> ======================================================
> 
> ----------8<----------
> QWidget center = new QWidget();
> setCentralWidget(center);
> 
> QTFillLayout layout = new QTFillLayout();
> center.setLayout(layout);
> 
> QWidget widget = new QWidget();
> layout.addWidget(widget,"");
> 
> QTFillLayout layout2 = new QTFillLayout();
> widget.setLayout(layout2);
> 
> QLabel label = new QLabel();
> label.setText("BlaBla");
> layout2.addWidget(label, "");
> 
> QPushButton button = new QPushButton();
> button.setText("B1");
> layout2.addWidget(button,"");
> ----------8<----------
> 
> Renderes an empty window but when I rearrange the setting of the layout
> like this:
> 
> ----------8<----------
> QWidget center = new QWidget();
> setCentralWidget(center);
> 
> QTFillLayout layout = new QTFillLayout();
>               
> QWidget widget = new QWidget();
> layout.addWidget(widget,"");
> 
> QTFillLayout layout2 = new QTFillLayout();
> widget.setLayout(layout2);
> 
> QLabel label = new QLabel();
> label.setText("BlaBla");
> layout2.addWidget(label, "");
> 
> QPushButton button = new QPushButton();
> button.setText("B1");
> layout2.addWidget(button,"");
> 
> layout.addWidget(widget,"");
> center.setLayout(layout);
> ----------8<----------
> 
> The layout works.
> 
> Problem 2: Using layout#addWidget(QWidget)
> ==========================================
> 
> Fragment 1 from above gives:
> 
> "Invalid memory access of location 00000000 eip=08d15e36"
> 
> Fragment 2 from above gives:
> 
>> QtJambi: Exception pending in native code
>> Exception in thread "main" com.trolltech.qt.QNoNativeResourcesException: 
>> Function call on incomplete object of type: 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper
>>      at 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper.sizeHint(QLayoutItem.java:70)
>>      at 
>> org.ufacekit.ui.qt.core.layouts.QTFillLayout.sizeHint(QTFillLayout.java:78)
>>      at com.trolltech.qt.gui.QWidget.__qt_show(Native Method)
>>      at com.trolltech.qt.gui.QWidget.show(QWidget.java:2134)
>>      at 
>> org.ufacekit.ui.qt.example.TestFillLayout.main(TestFillLayout.java:39)
>> QtJambi: Exception pending in native code
>> Exception in thread "main" com.trolltech.qt.QNoNativeResourcesException: 
>> Function call on incomplete object of type: 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper
>>      at 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper.setGeometry(QLayoutItem.java:62)
>>      at 
>> org.ufacekit.ui.qt.core.layouts.QTFillLayout.setGeometry(QTFillLayout.java:68)
>>      at com.trolltech.qt.gui.QWidget.__qt_show(Native Method)
>>      at com.trolltech.qt.gui.QWidget.show(QWidget.java:2134)
>>      at 
>> org.ufacekit.ui.qt.example.TestFillLayout.main(TestFillLayout.java:39)
>> QtJambi: Exception pending in native code
>> Exception in thread "main" com.trolltech.qt.QNoNativeResourcesException: 
>> Function call on incomplete object of type: 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper
>>      at 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper.setGeometry(QLayoutItem.java:62)
>>      at 
>> org.ufacekit.ui.qt.core.layouts.QTFillLayout.setGeometry(QTFillLayout.java:68)
>>      at com.trolltech.qt.gui.QWidget.__qt_show(Native Method)
>>      at com.trolltech.qt.gui.QWidget.show(QWidget.java:2134)
>>      at 
>> org.ufacekit.ui.qt.example.TestFillLayout.main(TestFillLayout.java:39)
>> QtJambi: Exception pending in native code
>> Exception in thread "main" com.trolltech.qt.QNoNativeResourcesException: 
>> Function call on incomplete object of type: 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper
>>      at 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper.setGeometry(QLayoutItem.java:62)
>>      at 
>> org.ufacekit.ui.qt.core.layouts.QTFillLayout.setGeometry(QTFillLayout.java:68)
>>      at com.trolltech.qt.gui.QWidget.__qt_show(Native Method)
>>      at com.trolltech.qt.gui.QWidget.show(QWidget.java:2134)
>>      at 
>> org.ufacekit.ui.qt.example.TestFillLayout.main(TestFillLayout.java:39)
>> QtJambi: Exception pending in native code
>> Exception in thread "main" com.trolltech.qt.QNoNativeResourcesException: 
>> Function call on incomplete object of type: 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper
>>      at 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper.setGeometry(QLayoutItem.java:62)
>>      at 
>> org.ufacekit.ui.qt.core.layouts.QTFillLayout.setGeometry(QTFillLayout.java:68)
>>      at com.trolltech.qt.gui.QWidget.__qt_show(Native Method)
>>      at com.trolltech.qt.gui.QWidget.show(QWidget.java:2134)
>>      at 
>> org.ufacekit.ui.qt.example.TestFillLayout.main(TestFillLayout.java:39)
>> QtJambi: Exception pending in native code
>> Exception in thread "main" com.trolltech.qt.QNoNativeResourcesException: 
>> Function call on incomplete object of type: 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper
>>      at 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper.sizeHint(QLayoutItem.java:70)
>>      at 
>> org.ufacekit.ui.qt.core.layouts.QTFillLayout.sizeHint(QTFillLayout.java:78)
>>      at com.trolltech.qt.gui.QApplication.exec(Native Method)
>>      at 
>> org.ufacekit.ui.qt.example.TestFillLayout.main(TestFillLayout.java:40)
>> QtJambi: Exception pending in native code
>> Exception in thread "main" com.trolltech.qt.QNoNativeResourcesException: 
>> Function call on incomplete object of type: 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper
>>      at 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper.setGeometry(QLayoutItem.java:62)
>>      at 
>> org.ufacekit.ui.qt.core.layouts.QTFillLayout.setGeometry(QTFillLayout.java:68)
>>      at com.trolltech.qt.gui.QApplication.exec(Native Method)
>>      at 
>> org.ufacekit.ui.qt.example.TestFillLayout.main(TestFillLayout.java:40)
>> QtJambi: Exception pending in native code
>> Exception in thread "main" com.trolltech.qt.QNoNativeResourcesException: 
>> Function call on incomplete object of type: 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper
>>      at 
>> com.trolltech.qt.gui.QLayoutItem$ConcreteWrapper.sizeHint(QLayoutItem.java:70)
>>      at 
>> org.ufacekit.ui.qt.core.layouts.QTFillLayout.sizeHint(QTFillLayout.java:78)
>>      at com.trolltech.qt.gui.QApplication.exec(Native Method)
>>      at 
>> org.ufacekit.ui.qt.example.TestFillLayout.main(TestFillLayout.java:40)
> 
> The example i used is
> http://doc.trolltech.com/4.4/layouts-borderlayout.html, I don't know C++
> but I think I translated this appropriately into Java.
> 
> Tom
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qt-jambi-interest mailing list
> [email protected]
> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to