Results 1 to 5 of 5

Thread: QwtLegend - set background color

  1. #1
    Join Date
    Sep 2011
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default QwtLegend - set background color

    Hello,

    I am really desperating, because there is no information available in internet and I am trying since 4 hours to set the background of my QwtLegend from transparent to non transparent. Nothing works so far

    I guess its a simple thing, so please give me that advice how i can set the background of my QwtLegend item from transparent to any color. Thank you all!

    saracaeus

  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: QwtLegend - set background color

    The legend widget is a container with some widgets inside. One of them is a scrollview where the legend item widgets are. A QwtPlotLegendItem is a plot item on the canvas and isn't a widget at all.
    What element is it, where you want to have a background ?

    Uwe

  3. #3
    Join Date
    Sep 2011
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtLegend - set background color

    Thank you, Uwe, for your answer. I tried some stuff according to it. I tried already getting the items of the legend with legendItems(), zero itmes are returned, then I tried to set the backgroundRole of the QScrollArea (which is the parent of the contentsWidget()), didnt work. So I really wonder which widget I should take to set the background color.

    Sorry for this noobish kind of answer, but I need to modify a library written by somebody else and the original writer has implemented this legend with a QwtLegend. Thats the reason why I really dont know about it.

    All I see is a rectangle box where some curve item labels are listet. This rectangle box should be filled with a background color before the curve item labels are drawn, so the grid item behind the legend item doesnt not shine through.

    Any help is appreciated.

  4. #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: QwtLegend - set background color

    When the legend is on top of the grid item it seems to be something on the canvas. This might be an "external" QwtLegend or a QwtPlotLegendItem ( what is the better implementation ). How to set the background is completely different.

    Uwe

  5. #5
    Join Date
    Sep 2011
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QwtLegend - set background color

    Thank you! the hint with the "external" was right... so I found out that it is indeed an external legend and therefore I only have to override the legend's paintEvent() to draw my frame with filled background

    Cheers!

Similar Threads

  1. Background color
    By FelixB in forum Qwt
    Replies: 4
    Last Post: 24th June 2013, 08:03
  2. How to set QPainter Background color?
    By marc2050 in forum Newbie
    Replies: 2
    Last Post: 29th April 2011, 06:29
  3. QwtLegend background in a Tab Widget
    By AnnaP in forum Qwt
    Replies: 1
    Last Post: 7th February 2011, 13:21
  4. QTextTable background color?
    By anupamgee in forum Qt Programming
    Replies: 0
    Last Post: 26th June 2009, 11:40
  5. QPushbutton background color
    By omega36 in forum Qt Programming
    Replies: 27
    Last Post: 31st October 2008, 13:47

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.