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. How to paint a constellation mapping using Qt.
Forum Updated to NodeBB v4.3 + New Features

How to paint a constellation mapping using Qt.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 1.9k 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.
  • H Offline
    H Offline
    HYSuperman
    wrote on last edited by
    #1

    Trying to paint a constellation mapping using Qt.
    Basiclly, I need to paint a rectangular plane coordinate system, and some dynamicly produced points.
    x-coordinate and y-coordinate both range from -1.5 to +1.5.
    And the point in the system will be a complex number like: -0.245203354620380 + 0.289405396579750i

    I've tried the class QPainter. But I don't know how to paint points anytime and not eliminate the formal points.
    It's like I can only paint one point a time using QWidget::paintevent method...

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

      Hi and welcome to devnet,

      Doesn't QPainter::drawPoints fit ?

      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
      0
      • H Offline
        H Offline
        HYSuperman
        wrote on last edited by
        #3

        It fits.
        But what I want to do is to catch a data stream at anytime and draw the point the data gives me on the widget.
        How can I make it happen?

        [quote author="SGaist" date="1408432772"]Hi and welcome to devnet,

        Doesn't QPainter::drawPoints fit ?[/quote]

        1 Reply Last reply
        0
        • H Offline
          H Offline
          HYSuperman
          wrote on last edited by
          #4

          Now I'm using the QWidget::paintevent

          But it repaints the whole widget. How can I only update a new point and don't change other points?

          [quote author="SGaist" date="1408432772"]Hi and welcome to devnet,

          Doesn't QPainter::drawPoints fit ?[/quote]

          1 Reply Last reply
          0
          • JohanSoloJ Offline
            JohanSoloJ Offline
            JohanSolo
            wrote on last edited by
            #5

            IIRC you can give a region argument to the update method, which then triggers the paintEvent calling.

            `They did not know it was impossible, so they did it.'
            -- Mark Twain

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

              There are several possibilities, keep a list of your points, update it and redraw them all. Use a QPixmap, draw each new point on it then just draw this pixmap in your widget.

              Or look at e.g. Qwt which provides facilities for that kind of drawing.

              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
              0

              • Login

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