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. QPainter: Problem with drawing trajectory of a planet

QPainter: Problem with drawing trajectory of a planet

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

    Hi! I'm a novice in Qt development, so sorry for asking dumb questions.
    I found some example in Qt that uses QPainter and altered it for my case. I tried to draw a trajectory of a planet which revolves around a "Sun" and I succeeded. The thing I'm stuck in is I don't know how to tell the program to clear the background in the beginning and then not to continue clearing it because I want to see the trajectory of the planet.

    1. I tried setAutofillBackground(true), but it doesn't suit me cause it clears background all the time.
    2. Then I tried
      painter.setBackgroundMode(Qt::TransparentMode);
      it does the same. If I turn clearing of background in both cases off , I get some messy imprint of my screen with different windows in it. Could you please give me an advice how to solve the problem?
      Thanks in advance!
    1 Reply Last reply
    0
    • A Offline
      A Offline
      Arnaut
      wrote on last edited by
      #2

      You may try to set "Qt::WA_OpaquePaintEvent":http://developer.qt.nokia.com/doc/qt-4.8/qt.html#WidgetAttribute-enum attribute, but I suggest you paint the trajectory on a pixmap and then use the paint event to draw the pixmap on your widget.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        LeoQ
        wrote on last edited by
        #3

        Ok. I'll try that. Thanks!

        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 Extensions
        • Unsolved