[Qt-interest] GUI elements size update

Guillaume Spalla guillaume.spalla at gmail.com
Thu Jan 7 12:57:17 CET 2010


Dear all,

I am developing a GUI and I am experiencing the following issue:
I have a QGraphicsScene displayed by a QGraphicsView. Inside the
QGraphicsScene there is a QWidget containing several QLabel objects.
When the user is doing a specific action, the content of the QLabels is
modified, and I want to update the size of the QLabels and the QWidget to
fit the new content.
Now come the strange behavior: to do this size update, just after modifying
the content of the QLabel, I am calling "adjustSize":

label1->setText("new text");
label1->adjustSize();
widget->adjustSize();

That does not work and the size is not updated.

Now if I am calling these adjustSize() functions after a few ms (currently I
am using a QTimer), then it works.

So basically it works now, but it is not very "clean". I am just wondering
what I have done wrong ... Does anyone has a clue for that ? I am using Qt
4.5.2.

Thanks in advance,

Best regards,

Guillaume
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100107/a4b24319/attachment.html 


More information about the Qt-interest-old mailing list