Results 1 to 5 of 5

Thread: Qwt: Using QwtPlotPicker on multiple plots

  1. #1
    Join Date
    Sep 2007
    Location
    Vienna, Austria
    Posts
    19
    Thanks
    10
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Question Qwt: Using QwtPlotPicker on multiple plots

    Hi,

    i'm looking for solution for the following problem:

    i have some qwtplots lined vertically that have the same x-axis-scaling, but different y-axis.

    now i have a qwtplotpicker on each plot-canvas attached and when i select a point for example in the first plot (i get a crossrubberband, like in the bode example), i want to have a vertical rubberband in the other inactive plots shown at the same x coordinate.

    i found a solution for qwt 4.2.0 which used the outline pen, but that's obsolete.

    my current approach is to connect the qwtplotpicker::moved signal to a slot which iterates through all plots and sends a update() to the paintevent where i tried to draw the rubberband using picker->drawRubberBand(), which didn't worked.

    is there a solution without deriving qwtplotpicker?

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

    Default Re: Qwt: Using QwtPlotPicker on multiple plots

    What about using a QwtPlotMarker ( VLine style ) ?

    Uwe

  3. The following user says thank you to Uwe for this useful post:

    y.shan (3rd October 2007)

  4. #3
    Join Date
    Aug 2007
    Posts
    275
    Thanks
    28
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qwt: Using QwtPlotPicker on multiple plots

    hi y.shan and uwe and all,

    I was wondering if you could help me with these.

    My problem is to make two qwtplots lined vertically that have the same x-axis-scaling, but different y-axis.

    How did you implement this?

    baray98

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

    Default Re: Qwt: Using QwtPlotPicker on multiple plots

    Have a look at the implementation of PlotMatrix::alignVAxes in the plot matrix example; http://qwt.svn.sourceforge.net/viewv...pp?view=markup.

    The trick is to calculate the maximum extent of all vertical axes and to assign it to all of them.

    HTH,
    Uwe

    PS: Please start a new thread, when you ask for something completely different.

  6. #5
    Join Date
    Sep 2007
    Location
    Vienna, Austria
    Posts
    19
    Thanks
    10
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: Qwt: Using QwtPlotPicker on multiple plots

    yeah, that plotmatrix example also helped me alot,
    i had the same problem with aligning my plots vertically (if that is the problem you have) and i solved it like this way


    Qt Code:
    1. void myPlotFrame::paintEvent(QPaintEvent *pe)
    2. {
    3. QListIterator<QwtPlot*> it(myPlots); //i have a QList<QwtPlot*> for my plots
    4. QwtPlot *current_plot;
    5. int maxExtent = 0;
    6.  
    7. while (it.hasNext())
    8. {
    9. current_plot = it.next();
    10.  
    11. QwtScaleWidget *scaleWidget = current_plot->axisWidget(QwtPlot::yLeft);
    12. QwtScaleDraw *sd = scaleWidget->scaleDraw();
    13. sd->setMinimumExtent(0);
    14.  
    15. const int extent = sd->extent(
    16. QPen(Qt::black, scaleWidget->penWidth()),
    17. scaleWidget->font() );
    18. if ( extent > maxExtent )
    19. maxExtent = extent;
    20. }
    21.  
    22. it.toFront();
    23. while (it.hasNext())
    24. {
    25. current_plot = it.next();
    26. QwtScaleWidget *scaleWidget = current_plot->axisWidget(QwtPlot::yLeft);
    27. scaleWidget->scaleDraw()->setMinimumExtent(maxExtent);
    28. }
    29. }
    To copy to clipboard, switch view to plain text mode 

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.