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. Issue with QPolygonF and QGraphicsPolygonItem (brought a picture)
Forum Updated to NodeBB v4.3 + New Features

Issue with QPolygonF and QGraphicsPolygonItem (brought a picture)

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

    Hello,

    Picture

    I seem to be having this unwanted black segment when drawing triangles. Here's what I did with the QPolygonF:

    qreal root = qSqrt(3)/2;
    
    QPolygonF DownwardTriangle = QPolygonF(3);
    DownwardTriangle << QPointF(root, .5)*80 << QPointF(-root, .5)*80 << QPointF(0, -1)*80 << QPointF(root, .5)*80;
    

    and here's how I added it to the QGraphicsScene:

    auto foo = WindowScene.addPolygon(DownwardTriangle, QPen(), GrayBrush);
    foo->setPos(100, 100);
    

    I tried both fillRules but I got the black segment (from the top-right corner to the center of the triangle) in both cases regardless. I can't get rid of it. The top-right corner matches the first and last QPointF that I stored inside DownwardTriangle (which is QPointF(root, .5)*80).

    Any help would be appreciated. Thank you.

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

      Hi

      U have a garbage points.

      QPolygonF DownwardTriangle = QPolygonF(3);
      <-- U must delete "QPolygonF(3)"

      1 Reply Last reply
      1
      • P Offline
        P Offline
        Pippin
        wrote on last edited by
        #3

        @Devopia53

        Thank you! The problem disappears if I drop the = QPolygonF(3); :)

        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