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. Unevenly drawn circle from QPainter->drawEllipse()
Forum Updated to NodeBB v4.3 + New Features

Unevenly drawn circle from QPainter->drawEllipse()

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.8k 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.
  • G Offline
    G Offline
    Greger
    wrote on last edited by
    #1

    I'm drawing the following circle in a QGraphicsObject::paint():

    !http://dl.dropbox.com/u/623207/Qt_Uneven_ellipse.png(Uneven drawEllipse)!

    using:
    painter->drawEllipse(QRectF(...));
    with a Qt::SolidPattern brush and a QPen() with an adjusted width.

    is there any way I can remove the extra non-circle part of the border seen to the right in the picture?

    Thanks, Greger

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dridk
      wrote on last edited by
      #2

      I think you can draw your primitive inside a QPainterPath, and then make the difference between booth.
      Look at : "QPainterPath doc":http://qt-project.org/doc/qt-4.8/qpainterpath.html

      Nothing in Biology Makes Sense Except in the Light of Evolution

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Greger
        wrote on last edited by
        #3

        Thanks dridk, that did the trick! Not that I understand why it makes a difference.

        So using

        @
        QPainterPath circle_path;
        circle_path.addEllipse(circle);
        painter->drawPath(circle_path);
        @

        makes a nicer circle than

        @
        painter->drawEllipse(circle);
        @

        At least with Qt 4.7.4 on a Mac.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dbzhang800
          wrote on last edited by
          #4

          All you need is the border of the circle? If so, you should.

          @
          painter.setBrush(Qt::NoBrush);
          @

          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