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. Clear previous drawings on repaint
Forum Updated to NodeBB v4.3 + New Features

Clear previous drawings on repaint

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 420 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.
  • L Offline
    L Offline
    leochou
    wrote on last edited by leochou
    #1

    I have a totally transparent, top-level, sreen-sized widget, which shows some text waterwarks on macOS. I need to update the system time text on one-minutes intervals. When I call the repaint method, the previously drawn text is not erased completely. Please see the attached image and demo project.

    I've seen several posts on stackoverflow about this topic, but none of them works for me. Could anyone show the most correct way to handle it with Qt? Thanks!

    Leo

    MrZot.jpg

    Demo

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

      Hi and welcome to devnet,

      What if you paint the whole widget with a transparent rect before painting the text ?

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

      L 2 Replies Last reply
      1
      • SGaistS SGaist

        Hi and welcome to devnet,

        What if you paint the whole widget with a transparent rect before painting the text ?

        L Offline
        L Offline
        leochou
        wrote on last edited by leochou
        #3

        @SGaist I've uploaded a demo project. Could you please show me what's the most correct way to clear background manually? I've tried many ways, but none of them works.

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          What if you paint the whole widget with a transparent rect before painting the text ?

          L Offline
          L Offline
          leochou
          wrote on last edited by
          #4

          @SGaist I'm using Qt 6.2.1 on macOS Moterey. Please take a look at the uploaded screenshot. There is a text watermark in a hollow effect left on the top.

          1 Reply Last reply
          0
          • JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by JoeCFD
            #5

            change your window size setGeometry(0, 0, 950, 550); When I run your code, I can not stop it. It uses full screen of my terminal. I have to restart machine. I do not see your problem on Ubuntu 18 with Qt 5.15.2.

            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