Results 1 to 5 of 5

Thread: Removing Legend

  1. #1
    Join Date
    May 2008
    Posts
    25
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Removing Legend

    Is there a way to remove or hide a Legend once it has been added to a QwtPlot?

    I looked at the documentation, but couldn't find anything that did the trick. setHidden(bool) and setVisible(bool) also don't work for this...

    Am I being a little slow and missing something simple?

    Cheers

  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: Removing Legend

    plot->insertLegend(NULL). Guess "delete plot->legend()" will also work, but I havn't checked this.

    Uwe

  3. #3
    Join Date
    May 2008
    Posts
    25
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing Legend

    Hi again Uwe,

    I can't seem to get either of these options to work. Both create a crash in the program.

    As soon as I issue the plot->insertLegend(NULL) it crashes, it does compile though

    Any thoughts?

  4. #4
    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: Removing Legend

    Start the debugger and check where it crashes ( something everyone should do before reporting ).

    QwtPlot::insertLegend deletes the legend, that was previously inserted. When you also delete it in your application it might be the reason for the crash.

    Uwe

  5. #5
    Join Date
    May 2008
    Posts
    25
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Removing Legend

    Hi Uwe,

    Yep, I was running it in debugger and it was crashing. Turns out that the debugger was corrupted and not debugging properly. Fixed now, as is the Legend hiding.

    Thanks.

Similar Threads

  1. Replies: 2
    Last Post: 5th December 2008, 20:11
  2. Qwt Legend
    By maxpayne in forum Qwt
    Replies: 4
    Last Post: 15th October 2008, 17:17
  3. removing model Items
    By gyre in forum Newbie
    Replies: 2
    Last Post: 25th November 2007, 20:10
  4. removing child widget
    By db in forum Newbie
    Replies: 1
    Last Post: 16th August 2007, 12:19
  5. QTable, Removing cell focus
    By Kubil in forum Qt Programming
    Replies: 2
    Last Post: 27th July 2007, 10:13

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.