Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Q: Qt - [c++] QDialog gets repainted when overlay dialog closes
Forum Updated to NodeBB v4.3 + New Features

Q: Qt - [c++] QDialog gets repainted when overlay dialog closes

Scheduled Pinned Locked Moved Solved Game Development
6 Posts 3 Posters 1.0k Views
  • 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.
  • K Offline
    K Offline
    kevin_d
    wrote on last edited by
    #1

    Hello Qt Forum!

    I am manually drawing a background (with lines and polygons) on a dialog, which is rendered at the paintEvent(QPaintEvent *) method.
    Then, an additional dialog is shown, partially overlying on the background-dialog.
    Whenever such an overlay-dialog closes, the background dialog gets fully visible, and redraws all the background (with hundrets of polygons) again.

    This causes a delay when showing, hiding overlay dialogs.

    Is there a possibility, to 'cache' the drawn background area, so it needs to be rendered only once?

    If i suppress all following paintEvents, all the manually painting gets lost and the dialog only shows the background color ...

    Thanks, cheers, kevind_d

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kevin_d
      wrote on last edited by
      #2

      Is it possible to prevent the dialog from being repainted and keep the initial graphic contents?

      cheers, kevin

      Christian EhrlicherC 1 Reply Last reply
      0
      • K kevin_d

        Is it possible to prevent the dialog from being repainted and keep the initial graphic contents?

        cheers, kevin

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        When the os asks to redraw something you have to do it - noone is doing caching here (how should it work though - how should someone except you know that nothing has changed in between)
        The only way I see is to cache the whole painting in a QImage and only draw the QImage in paintEvent()

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        3
        • K Offline
          K Offline
          kevin_d
          wrote on last edited by
          #4

          Hello!

          Yes, i was hoping for a hack for this :-)

          Thanks, solved

          1 Reply Last reply
          0
          • K kevin_d has marked this topic as solved on
          • K Offline
            K Offline
            kevin_d
            wrote on last edited by
            #5

            It still seems odd, that the dialog needs repainting, when it is not resized ...

            JonBJ 1 Reply Last reply
            0
            • K kevin_d

              It still seems odd, that the dialog needs repainting, when it is not resized ...

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @kevin_d It needs repainting because it was (partially) obscured and now needs to be shown fully again, normal windows behaviour.....

              1 Reply Last reply
              1

              • Login

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