Repaint problem



  • Hello,

    I am using a structure for displaying some icons as follows:

    QGraphicsScene that contains a custom QGraphicsWidget which contains several custom QGraphicsLayoutItem.

    Everything works fine when using local images. But when using online images, I have a kind of refreshing problem. I download the image with the approach explained "here":http://qt-project.org/wiki/Download_Data_from_URL and assign it to a QPixmap.

    I have experienced a very strange behaviour. When the QGraphicsWidget is displayed, the icon is drawn like if it was cropped and, after that(without closing my application), when I click in any other window, the icon is re-drawn correctly. So, as soon as my application loses the focus, the icon is correctly drawn. It seems like I need to do a repaint or something like that, but I don't know where and/or how.

    Any help would be appreciated.

    Thank you in advance.



  • Maybe you can attach an update call of the ui to some events or even to a qtimer?



  • Thank you for your reply. I tried that (adding an update call to the SLOT called when the SIGNAL is emitted), but then I get only the cropped version of the logo. If I do not add the update, then the image does not appear at all until I change the focus to another application.



  • have you tried different ViewportUpdateMode? or before calling update() in slot try to do a dummy resize() of widget



  • It is working now with the resize before the update, thank you!

    I had previously solved the problem showing a dummy splashscreen without image, so it was doing the trick, but I think resizing is a better approach.

    Thank you again!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.