Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Repaint problem
Qt 6.12 LTS is out! See what's new in the release blog

Repaint problem

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          NicuPopescu
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt
            • Unsolved