Florian Hübner wrote:
> Hi everyone,
> I have a problem with the size of a QWidget. Whenever its painted I try 
> to set the correct size but for some reason it doesnt work.

...

>              rect().setWidth(image_.width());
>              rect().setHeight(image_.height());
> 
> For some reason it seems to ignore both set methods. Any ideas what 
> could have went wrong?


Hi Florian,

QWidget::rect() returns a copy of the widget's geometry rectangle, so 
your setWidth() and setHeight will only modify the temporary objects 
returned by them. To update a widgets geometry you can use the 
setGeometry(), move() or resize() functions:

http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QWidget.html#setGeometry(com.trolltech.qt.core.QRect)
http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QWidget.html#move(com.trolltech.qt.core.QPoint)
http://doc.trolltech.com/qtjambi-4.4/html/com/trolltech/qt/gui/QWidget.html#resize(com.trolltech.qt.core.QSize)

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

Reply via email to