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 draw curve with arc?
Forum Updated to NodeBB v4.3 + New Features

How to draw curve with arc?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 476 Views 2 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.
  • N Offline
    N Offline
    n-2204
    wrote on 10 Jun 2021, 14:19 last edited by
    #1

    Hi All,
    I'm sharing the code, Using this code drawing half circle(curve ) how to add arrow at the end of this curve ?
    Or is there other way to draw curve with direction/arrow. but I'm drawing this curve inside the circle so i think using radius its better way.
    CHPlotCurve--derived from QwtPlotCurve class
    CHPlotGraph2D-2D Graph derived from QwtPlot

      for (int irows = 0, maxI = table1->rowCount(); irows < maxI; ++irows)
      {        
          double x1 = table1->data(table1->index(irows, 1)).toDouble(&ok1);
          double y1 = table1->data(table1->index(irows, 2)).toDouble(&ok2);
     QVector <double> ax,ay;
     for (double angle = 0; angle <= 3.2; angle += 0.00314)
              {
                  double ax1 = x1 + (r / 2) * cos(angle);
                  double ay1 = y1 + (r / 2) * sin(angle);
                  ax.append(ax1);
                  ay.append(ay1);
                  CHPlotCurve* arc = (CHPlotCurve*)pGr->insertCurve("arc", CHPlotGraph2D::Line, false);
                  arc->setSamples(ax, ay);
                  arc->setPen(Qt::blue);           
              }
    

    Thankyou. Your answers are welcome

    1 Reply Last reply
    0
    • N n-2204
      16 Jun 2021, 10:02

      Can anyone suggest something? refer any examples/link

      T Offline
      T Offline
      TheGringerEye
      wrote on 17 Jun 2021, 14:41 last edited by
      #5

      @n-2204 https://www.w3schools.com/code/tryit.asp?filename=GRLN84LQBK8O if I understood correctly what you wanted, then rate it

      I try to learn English.

      1 Reply Last reply
      2
      • N Offline
        N Offline
        n-2204
        wrote on 11 Jun 2021, 09:54 last edited by
        #2

        How to draw like this ?

        38b1cfe1-a9fd-4807-8657-43a348a44167-image.png

        1 Reply Last reply
        0
        • N Offline
          N Offline
          n-2204
          wrote on 16 Jun 2021, 10:02 last edited by
          #3

          Can anyone suggest something? refer any examples/link

          M T 2 Replies Last reply 17 Jun 2021, 14:22
          0
          • N n-2204
            16 Jun 2021, 10:02

            Can anyone suggest something? refer any examples/link

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 17 Jun 2021, 14:22 last edited by
            #4

            @n-2204

            Hi
            Since you are using a QwtPlotCurve as base, i think you have to
            override
            https://qwt.sourceforge.io/class_qwt_plot_curve.html#a2307196a17121dc72c2c88a0c5a46dc7

            and draw it your self.

            I think not QWT offers this out of the box but its not an official Qt Module so I dont know it that well.

            1 Reply Last reply
            1
            • N n-2204
              16 Jun 2021, 10:02

              Can anyone suggest something? refer any examples/link

              T Offline
              T Offline
              TheGringerEye
              wrote on 17 Jun 2021, 14:41 last edited by
              #5

              @n-2204 https://www.w3schools.com/code/tryit.asp?filename=GRLN84LQBK8O if I understood correctly what you wanted, then rate it

              I try to learn English.

              1 Reply Last reply
              2

              • Login

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