Results 1 to 6 of 6

Thread: Hide QwtLegend after inserting it???

  1. #1
    Join Date
    Jun 2008
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Hide QwtLegend after inserting it???

    Hi there...

    I am trying to hide the legend in my plot AFTER the insertion of it.
    I tried the hide() or setVisible() methods but they don't work with the legend!
    Is it somehow possible? Is there a method that helps on that?

    Using Qwt 6.0.1!!!

    Thanks in advance...

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

    Default Re: Hide QwtLegend after inserting it???

    Qt Code:
    1. plot->insertLegend( NULL );
    To copy to clipboard, switch view to plain text mode 

    HTH,
    Uwe

  3. #3
    Join Date
    Jun 2008
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Hide QwtLegend after inserting it???

    Unfortunately it doesn't help Uwe...
    Program can't even start.
    Is there any possibility that this kind of functionality will get implemented in the future???

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

    Default Re: Hide QwtLegend after inserting it???

    It is implemented - whatever the reason of your crash is, you are the only one who can fix it.

    Uwe

  5. #5
    Join Date
    Jun 2008
    Posts
    12
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Hide QwtLegend after inserting it???

    Correction

    It helps:
    Qt Code:
    1. plot->insertLegend( NULL );
    To copy to clipboard, switch view to plain text mode 
    I probably didn't compile the project clean.

    Thanks for the help...

  6. #6
    Join Date
    Jun 2014
    Posts
    16
    Thanks
    1
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Hide QwtLegend after inserting it???

    But what is a reason to not support show()/hide()? QwtAbstractLegend inherits QWidget, where show()/hide() are public methods. Ignoring show()/hide() breaks expected behavior. I am assuming this is due to QwtPlotLayout, which is not a QLayout.

    Qwt looks designed very well with high level of customization/flexibility. And there is so-called "naked" interface, where a component provides direct access to its subcomponents, rather then expose only subcomponents properties (and so have full cotrol over side effects). Being "naked", a component must fully observe its subcomponents (via signals, eventFilter(), weak pointers, etc.).

    So, one would expect
    Qt Code:
    1. legend->setParent(NULL)
    To copy to clipboard, switch view to plain text mode 
    acts the same as
    Qt Code:
    1. plot->insertLegend( NULL );
    To copy to clipboard, switch view to plain text mode 
    Is it OK, or breaks the code?

    Note: In the first case QwtPlot must observe its legend (e.g. via handling ChildRemoved events).

    Does Qwt have such observation everywhere in its code?
    Thanks, Alex

Similar Threads

  1. Replies: 5
    Last Post: 26th June 2015, 15:00
  2. Qwt 6.1.0 trunk and QwtLegend
    By carhun in forum Qwt
    Replies: 0
    Last Post: 22nd August 2012, 09:13
  3. QwtLegend size
    By baray98 in forum Qwt
    Replies: 3
    Last Post: 11th May 2010, 09:55
  4. QwtLegend size
    By baray98 in forum Qwt
    Replies: 0
    Last Post: 10th May 2010, 05:26
  5. Set Title for QWTLegend...
    By umulingu in forum Qwt
    Replies: 3
    Last Post: 23rd March 2010, 09:28

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.