Results 1 to 4 of 4

Thread: how can be known a curve is attached?

  1. #1
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    70
    Qt products
    Qt5
    Platforms
    Windows

    Default how can be known a curve is attached?

    hi
    is there any QwtPlotCurve::function to know is a curve attached or not?
    for example there are curve1, curve2,...,curve100 and some of these curves are attached. i need if curve20 was attached now it is be detached

  2. #2
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    120
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how can be known a curve is attached?

    Hello,

    I didn't find any "QwtPlotCurve::isAttached()" method in the documentation. However, if you want to check if a curve is attached to a specific QwtPlot, you can get the list of all attached QwtPlotItems by calling QwtPlot::intemList() (or more specifically: QwtPlotDict::itemList(). Note that QwtPlot is derived from QwtPlotDict). Then check if your curve is contained in this list.

    Best regards
    ars

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

    Alex22 (20th December 2015)

  4. #3
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    120
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how can be known a curve is attached?

    Hello,

    here's an update to my previous post (didn't rember it yesterday). From Qwt documentation of QwtPlotItem:
    QwtPlot * plot () const
    Return attached plot.
    So simply check if curve->plot() is null or not.

    Best regards
    ars

  5. The following user says thank you to ars for this useful post:

    Alex22 (21st December 2015)

  6. #4
    Join Date
    Mar 2016
    Posts
    14
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how can be known a curve is attached?

    Use signal void QwtPlot::itemAttached (QwtPlotItem *plotItem, bool on) and reimplement for each curve int QwtPlotCurve::rtti () const with Rtti_PlotUserItem + 1, + 2 ... + 100
    Qt Code:
    1. class MyCurve : public QwtPlotCurve
    2. {
    3. public:
    4. MyCurve(QwtPlotItem::RttiValues value)
    5. {
    6. m_value = value;
    7. }
    8. virtual int rtti () const
    9. {
    10. return m_value;
    11. }
    12. private:
    13. QwtPlotItem::RttiValues m_value;
    14. };
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 1
    Last Post: 29th September 2013, 10:12
  2. Replies: 4
    Last Post: 7th December 2011, 10:20
  3. getting attached curve to a plot
    By corrado1972 in forum Qwt
    Replies: 2
    Last Post: 22nd June 2011, 10:35
  4. Replies: 4
    Last Post: 29th April 2010, 07:11
  5. Replies: 1
    Last Post: 22nd January 2010, 15:34

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.