Results 1 to 9 of 9

Thread: problem with dot style

  1. #1
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default problem with dot style

    hello world,

    recently i make a graphic with line style and after this i have changed the style with this command :
    Qt Code:
    1. mycurve->attach( myPlot1 );
    2. mycurve->setStyle( QwtPlotCurve::Dots );
    3. mycurve->setPen( QPen( Qt::blue, 0.1 ) );
    To copy to clipboard, switch view to plain text mode 
    and to plot:
    Qt Code:
    1. QVector<double> x3(0);
    2. QVector<double> y3(0);
    3. x3.reserve(timeNb3);
    4. y3.reserve(timeNb3);
    5. x3 << Points3_OneXtwoY[i][z][0] ;
    6. y3 << Points3_OneXtwoY[i][z][1] ;
    7. }
    8. mycurve->setSamples(x3.data(),y3.data(),x3.size());
    9. myPlot3->replot();
    10. repaint();
    To copy to clipboard, switch view to plain text mode 

    all worked nice, but now i re-test this code but it don't plot with dots

    i have forget something but i don't understand what

    can you help me please ?

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with dot style

    what does the curve look like? are you sure you call replot *after* setting the style? what happens when you don't set the pen?

  3. #3
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: problem with dot style

    hello Felix

    1°) my curve it's here:
    http://imageshack.us/photo/my-images/339/curvei.jpg/

    2°) i have tested without modify Qpen and it don't change anything

    3°) i define style in the constructor and i use replot only in a method of my class "window". I just have tested replot in the constructor and it don't change anything

    ==> this is my real definition of curves in constructor:
    Qt Code:
    1. myPlot1 = new QwtPlot();
    2. myPlot2 = new QwtPlot();
    3. for ( int k = 0 ; k < NombrePrecipitesSimules ; ++k )
    4. {
    5. mycurve[0+k*nombreDoublePlot]->attach( myPlot1 );
    6. mycurve[0+k*nombreDoublePlot]->setStyle( QwtPlotCurve::Dots );
    7. //mycurve[0+k*nombreDoublePlot]->setPen( QPen( Qt::blue, 0.1 ) );
    8. mycurve[1+k*nombreDoublePlot]->attach( myPlot2 );
    9. mycurve[1+k*nombreDoublePlot]->setStyle( QwtPlotCurve::Dots );
    10. //mycurve[1+k*nombreDoublePlot]->setPen( QPen( Qt::blue, 0.1 ) );
    11. }
    To copy to clipboard, switch view to plain text mode 

    this is private attribut of my class:
    Qt Code:
    1. QwtPlot *myPlot1;
    2. QwtPlot *myPlot2;
    3. QVector< QwtPlotCurve* > mycurve;
    To copy to clipboard, switch view to plain text mode 

    and this is my utilisation:
    Qt Code:
    1. for (int i=0;i<nb;i++)
    2. {
    3. int timeNb3=0;
    4. timeNb3=Points3_OneXtwoY[i].size();
    5. QVector<double> x3(0);
    6. QVector<double> y3(0);
    7. x3.reserve(timeNb3);
    8. y3.reserve(timeNb3);
    9. //i fill Qvectors
    10. for (int z=0;z<timeNb3;z++)
    11. {
    12. x3 << Points3_OneXtwoY[i][z][0] ;
    13. y3 << Points3_OneXtwoY[i][z][1] ;
    14. }
    15. mycurve[2+i*nombreDoublePlot]->setSamples(x3.data(),y3.data(),x3.size());
    16. myPlot3->replot();
    17. repaint();
    To copy to clipboard, switch view to plain text mode 

    with: Points3_OneXtwoY a " vector<vector<vector<double>>> "

  4. #4
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with dot style

    I can't see anything wrong. where do you call "new QwtPlotCurve()?"

  5. #5
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: problem with dot style

    hello Fellix, thank for your help,

    in the constructor i have this:

    Qt Code:
    1. for ( int k = 0 ; k < nbDoubleCurve ; ++k )
    2. {
    3. QwtPlotCurve * curve= new QwtPlotCurve();
    4. mycurve.push_back(curve);
    5. }
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: problem with dot style

    why don't you set the style in the constructor? does it change anything if you do so? I still can't see any errors in your code

  7. The following user says thank you to FelixB for this useful post:

    21did21 (1st July 2011)

  8. #7
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: problem with dot style

    thank Felix for your help i will try to test a lot of different thing, if it's work i will explain toyou what was the problem

    EDIT:

    i have done some modification and now it's works but i don't understand why...
    Last edited by 21did21; 1st July 2011 at 16:39.

  9. #8
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: problem with dot style

    Now i have a problem to change the symbol of this curve...

    for the moment i have several dots, it's nice but i want to change dots by triangle

    I have done this in my constructor:
    Qt Code:
    1. MySymbol =new QwtSymbol();
    2. MySymbol->Triangle;
    3. mycurve->setStyle( QwtPlotCurve::Dots );
    4. mycurve->setSymbol( MySymbol );
    To copy to clipboard, switch view to plain text mode 

    My curve always have dots and Triangles are not taken into account i have always Dots.

    => if i erase this line:
    Qt Code:
    1. mycurve->setStyle( QwtPlotCurve::Dots );
    To copy to clipboard, switch view to plain text mode 

    my curve don't appears,

    So i think i haven't understand the difference between style and symbol, i don't want line but i want to change Dots by triangle

    i hope you can help me

    thank a lot

  10. #9
    Join Date
    May 2011
    Posts
    122
    Thanks
    34
    Platforms
    Windows

    Default Re: problem with dot style

    it's work now but i superpoze dots and triangles...

Similar Threads

  1. QAbstractItemView style problem
    By QAlex in forum Qt Programming
    Replies: 0
    Last Post: 10th December 2009, 10:53
  2. Problem with fill style
    By hasmik in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2009, 16:07
  3. Combobox style problem
    By zgulser in forum Qt Tools
    Replies: 5
    Last Post: 13th March 2009, 09:01
  4. Style Sheet Problem
    By zgulser in forum Qt Tools
    Replies: 8
    Last Post: 17th February 2009, 08:27
  5. [Qt 4.3.1]A problem with combobox style
    By Tamara in forum Qt Programming
    Replies: 3
    Last Post: 19th September 2007, 10:49

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.