Results 1 to 3 of 3

Thread: Doubt with dotted line

  1. #1
    Join Date
    Feb 2012
    Location
    Stuttgart / Germany
    Posts
    35
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question Doubt with dotted line

    Hello,

    My application is plotting graphs with line style and then there is a configuration dialog where the user can add dots on this lines. But when I press the checkbox to create the dots, nothing happens, my graph keeps the same. The part that I plot the graph is:

    Qt Code:
    1. // Insert new curves
    2. curveArray[iGraphCounter].setAxes(QwtPlot::xBottom,QwtPlot::yLeft+iGraphCounter);
    3. curveArray[iGraphCounter].setTitle(object->legend.c_str());
    4. curveArray[iGraphCounter].setRenderHint(QwtPlotItem::RenderAntialiased);
    5. curveArray[iGraphCounter].setLegendAttribute(QwtPlotCurve::LegendShowLine, true);
    6.  
    7. curveArray[iGraphCounter].setPen(QColor(iColorMap[iGraphCounter][0],iColorMap[iGraphCounter][1],iColorMap[iGraphCounter][2],iColorMap[iGraphCounter][3]));
    8. curveArray[iGraphCounter].setStyle(QwtPlotCurve::Lines);
    9. curveArray[iGraphCounter].setRawSamples(&object->xContent[0],&object->yContent[0],object->xContent.size());
    10. curveArray[iGraphCounter].attach(plot);
    To copy to clipboard, switch view to plain text mode 

    When the user press the combox to add the dots, the application goes to this part:

    Qt Code:
    1. if (dotLinesCheckBox->isChecked())
    2. {
    3. for (int i=0; i<iGraphCounter; i++)
    4. {
    5. curveArray[iGraphCounter].setSymbol(new QwtSymbol ( QwtSymbol::Ellipse , QBrush(curveArray[iGraphCounter].pen().color()), QPen(curveArray[iGraphCounter].pen().color()), QSize(5,5)));
    6. }
    7. }
    8. else
    9. {
    10. for (int i=0; i<iGraphCounter; i++)
    11. {
    12. curveArray[iGraphCounter].setSymbol(new QwtSymbol ( QwtSymbol::NoSymbol , QBrush(curveArray[iGraphCounter].pen().color()), QPen(curveArray[iGraphCounter].pen().color()), QSize(5,5)));
    13. }
    14. }
    15. plot->replot();
    To copy to clipboard, switch view to plain text mode 

    I think it's because my curves are already attached and then I cannot change. But I'm not sure. And if what I think it's true, how can I make it?
    How can I plot a graph with lines and then later add dots to the lines?

    Thanks in advance
    Best Regards

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

    Default Re: Doubt with dotted line

    You have to modify the curve pen ( QwtPlotCurve::setPen() ) - this is not the same pen as the pen of its symbol.

    Uwe

  3. #3
    Join Date
    Feb 2012
    Location
    Stuttgart / Germany
    Posts
    35
    Thanks
    6
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Doubt with dotted line

    Thanks Uwe, but the problem was another thing. It was a really stupid thing. If you check the code part I inserted before you're gonna see that my loop is using the variable "i", but inside of my loop I didn't change and I was using the variable "iGraphCounter", that's why it was not working, when I changed everything works fine.
    Thanks anyways.

Similar Threads

  1. Replies: 3
    Last Post: 2nd August 2013, 22:53
  2. problem with QGraphicsTextItem's black dotted line.
    By jonike in forum Qt Programming
    Replies: 1
    Last Post: 14th August 2011, 18:27
  3. How to remove the dotted rectangle of selection
    By jiveaxe in forum Qt Programming
    Replies: 5
    Last Post: 18th April 2010, 22:00
  4. Replies: 0
    Last Post: 17th November 2009, 21:19
  5. How to hide dotted lines around the focused control?
    By gimel in forum Qt Programming
    Replies: 3
    Last Post: 6th November 2008, 07:09

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.