Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Do not automatically erase background on QWidget paintEvent (OSX)
Forum Updated to NodeBB v4.3 + New Features

Do not automatically erase background on QWidget paintEvent (OSX)

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 1.4k Views 3 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.
  • G Offline
    G Offline
    GeraldBrandt
    wrote on last edited by GeraldBrandt
    #1

    Hi,

    When I create my widget, I do this:

    setBackgroundRole(QPalette::Base);
    setAutoFillBackground(false);
    setAttribute(Qt::WA_OpaquePaintEvent);
    

    which stops Qt from erasing the background on a paintEVent. It works perfectly on Windows and Linux. Under OSX, it seems the

    setAttribute(Qt::WA_OpaquePaintEvent);
    

    doesn't work. The widget gets erased on every paint event.

    Under Windows and Linux, if I remove the setAttribute(Qt::WA_OpaquePaintEvent); I get the same drawing as OSX with that call.

    Is this a known issue, or am I missing something under OSX?

    Run 5.14.1 on all platforms.

    Gerald

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What version of macOS ?
      Can you provide a minimal compilable example that shows that behavior ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What version of macOS ?
        Can you provide a minimal compilable example that shows that behavior ?

        G Offline
        G Offline
        GeraldBrandt
        wrote on last edited by
        #3

        @SGaist Catalina. Is there a minimal sample I can start from? I pretty new to Qt, moving from wxWidgets, so I'm not sure what the protocol is here.

        Gerald

        mrjjM 1 Reply Last reply
        0
        • G GeraldBrandt

          @SGaist Catalina. Is there a minimal sample I can start from? I pretty new to Qt, moving from wxWidgets, so I'm not sure what the protocol is here.

          Gerald

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @GeraldBrandt
          Hi
          @SGaist
          asks for a small example that shows the issue that he can just download it and run it and see
          if its easy to reproduce on his Mac.

          If we have to construct something we can run from code pieces we risk debugging something else
          so what we are after is a default GUI project with just enough code to see this.

          We cant upload zip file here so use online service and post the link.

          if its really is easy to recreate than state how to fast get it.

          Like "add a plain QWidget to the MainForm and apply the lines to it."

          G 1 Reply Last reply
          1
          • mrjjM mrjj

            @GeraldBrandt
            Hi
            @SGaist
            asks for a small example that shows the issue that he can just download it and run it and see
            if its easy to reproduce on his Mac.

            If we have to construct something we can run from code pieces we risk debugging something else
            so what we are after is a default GUI project with just enough code to see this.

            We cant upload zip file here so use online service and post the link.

            if its really is easy to recreate than state how to fast get it.

            Like "add a plain QWidget to the MainForm and apply the lines to it."

            G Offline
            G Offline
            GeraldBrandt
            wrote on last edited by
            #5

            @mrjj I was just checking. As I mentioned, I come from wxWidgets, and they had a minimal sample they wanted everyone to use as a starting point.

            Gerald

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You can start from the default widget project template with Qt Creator.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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