Results 1 to 8 of 8

Thread: Phasor Plotting with QwtPolar (drawing rays on a polar coordinate grid)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2012
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Phasor Plotting with QwtPolar (drawing rays on a polar coordinate grid)

    Yeah, I wanted to attach an item to the plot, but I'm worried that I'll have to impliment my own plot item for just drawing a simple line from the origin, I would think there should just be a function to draw a line like drawLine or something that takes the length of the line and angle of the line.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Phasor Plotting with QwtPolar (drawing rays on a polar coordinate grid)

    You can't simply draw to a widget - this is not how Qt works. On most platforms you can't event paint outside paint events at all. You also need to take care of the plot -> widget transformation, that is changing on different type of layout events or when zooming in/out. But having a class around a couple of lines of render code ( this is what your is plot item about) is nothing to be afraid of.

    QwtPlotMarker has a mode for drawing such a line - but I simply forgot to add a similar feature to QwtPolarMarker.

    Uwe

  3. #3
    Join Date
    Jan 2012
    Posts
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Phasor Plotting with QwtPolar (drawing rays on a polar coordinate grid)

    What I have now to post the data is this:

    d_grid = new QwtPolarGrid();
    d_grid->setPen(QPen(Qt::white));
    for ( int scaleId = 0; scaleId < QwtPolar::ScaleCount; scaleId++ )
    {
    d_grid->showGrid(scaleId);
    d_grid->showMinorGrid(scaleId);

    QPen minorPen(Qt::gray);
    #if 0
    minorPen.setStyle(Qt::DotLine);
    #endif
    d_grid->setMinorGridPen(scaleId, minorPen);
    }
    d_grid->setAxisPen(QwtPolar::AxisAzimuth, QPen(Qt::black));

    d_grid->showAxis(QwtPolar::AxisAzimuth, true);
    d_grid->showAxis(QwtPolar::AxisLeft, false);
    d_grid->showAxis(QwtPolar::AxisRight, false);
    d_grid->showAxis(QwtPolar::AxisTop, false);
    d_grid->showAxis(QwtPolar::AxisBottom, false);
    d_grid->showGrid(QwtPolar::Azimuth, true);
    d_grid->showGrid(QwtPolar::Radius, true);
    d_grid->attach(this);

    // curves
    m_curve = new QwtPolarCurve();
    m_curve->setPen(QPen(Qt::red));
    m_curve->setData(SinData(0,10));
    m_curve->setPen(QPen(Qt::red));
    m_curve->attach(this);
    replot();

    SinData is a class to return a QwtData pointer to setData, the arguments are an angle offset and amplitude of the line respectively. I'm attaching it to a QwtPolarPlot, the problem is I'm not seeing anything on the grid.

    This wasn't my code, someone else wrote it.

  4. #4
    Join Date
    Mar 2013
    Location
    Poland
    Posts
    15
    Thanks
    2
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Phasor Plotting with QwtPolar (drawing rays on a polar coordinate grid)

    bwnicewo, You solved it?

Similar Threads

  1. Replies: 0
    Last Post: 19th January 2012, 17:21
  2. Drawing a grid
    By LevelFour in forum Newbie
    Replies: 1
    Last Post: 14th February 2010, 16:38
  3. How to rotate qwt polar coordinate?
    By qmonkey in forum Qwt
    Replies: 5
    Last Post: 27th January 2010, 09:49
  4. Qwt Polar 0.1.0 - Qwt 5.2.0 - Qt 4.6.0
    By ronanf235 in forum Qt-based Software
    Replies: 1
    Last Post: 7th January 2010, 16:24
  5. drawing a grid
    By dreamer in forum Qt Programming
    Replies: 2
    Last Post: 27th April 2008, 09:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.