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. Problem with visualisation (straight lines look like broken lines)
Forum Updated to NodeBB v4.3 + New Features

Problem with visualisation (straight lines look like broken lines)

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 382 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.
  • Z Offline
    Z Offline
    zloi_templar
    wrote on last edited by
    #1

    Hello, i try to draw some lines and some polygons, all fine, but straight lines look like broken lines. I don't know, it's visualisation problem or something else, I will be glad to hear advice.

    For drawing i use qwt components

    class CurveSingle: public QwtPlotCurve
    ...
    cm = new CurveSingle();
    cm->setRenderHint(QwtPlotCurve::RenderAntialiased, true);
    ...
    

    Draw series

    QBrush brush;
    QPen p;
    p.setJoinStyle(Qt::RoundJoin);
    p.setCapStyle(Qt::RoundCap);
    brush.setStyle(Qt::SolidPattern);
    
    QPainterPath path;
    path.addPolygon(poly);                       
    painter->drawPolygon(poly);
    painter->fillPath(path, brush);
    

    Example of lines
    2.png

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      the problem you present is called aliasing. Antialiasing is the solution and QT has methods that "hint" how to deal with it. The process involves blending border pixels so that the edges fade into the background without looking so sharp.

      See http://www.java2s.com/Code/Cpp/Qt/SetrenderhinttoQPainterAntialiasing.htm

      Z 1 Reply Last reply
      1
      • Kent-DorfmanK Kent-Dorfman

        the problem you present is called aliasing. Antialiasing is the solution and QT has methods that "hint" how to deal with it. The process involves blending border pixels so that the edges fade into the background without looking so sharp.

        See http://www.java2s.com/Code/Cpp/Qt/SetrenderhinttoQPainterAntialiasing.htm

        Z Offline
        Z Offline
        zloi_templar
        wrote on last edited by
        #3

        @Kent-Dorfman ty, looks better, but a bit aliasing still present. Maybe exist some parameters like "degree of antialiasing"?

        Kent-DorfmanK 1 Reply Last reply
        0
        • Z zloi_templar

          @Kent-Dorfman ty, looks better, but a bit aliasing still present. Maybe exist some parameters like "degree of antialiasing"?

          Kent-DorfmanK Offline
          Kent-DorfmanK Offline
          Kent-Dorfman
          wrote on last edited by
          #4

          @zloi_templar some GPUs can also do a good job of antialiasing in opengl with the right settings but since you're using QPainter that's not really a direct option. Experimentation is a required part of becoming a subject matter expert.

          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