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 can I create a "pie" using QGraphics.
QtWS25 Last Chance

How can I create a "pie" using QGraphics.

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 764 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.
  • A Offline
    A Offline
    Alvaro.sal
    wrote on last edited by
    #1

    Hello forum, I want create a piece of pie using QGraphics, now I just get create a triangle but I need create a triangle with an arc (really a piece of pie). I saw an example using QPainter but my project is created using QGrapchics.

    Now I made an QPolygon:

    QPolygon triangle_s1;

    triangle_s1 << QPoint(0,0);
    triangle_s1 << QPoint(x1_s1,y_s1);
    triangle_s1 << QPoint(x2_s1,y_s1);
    triangle_s1 << QPoint(0,0);
    

    where x1_s1, x2_s1 and y_s1 are the coordinates for my triangle and I don't know how can I create the arc and paint inside my pie.

    So.. if somebody could help me I would very grateful.

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

      Hi and welcome to devnet,

      QGraphicsElipseItem comes to mind for that task.

      Hope it helps

      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
      • Joel BodenmannJ Offline
        Joel BodenmannJ Offline
        Joel Bodenmann
        wrote on last edited by
        #3

        Maybe this example might be helpful too: https://doc.qt.io/qt-5/qtwidgets-itemviews-chart-example.html
        It's not using QGraphics but it might help you figuring out some parts of the drawing logic or similar.

        Industrial process automation software: https://simulton.com
        Embedded Graphics & GUI library: https://ugfx.io

        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