Results 1 to 2 of 2

Thread: What determines color of text shown as axis label?

  1. #1
    Join Date
    Aug 2010
    Qt products
    MacOS X Unix/X11

    Default What determines color of text shown as axis label?

    Our plots draw just fine, except in some conditions the x and y axis labels, set with QwtPlot::setAxisTitle(), come out gray instead of black. I can't find anything anywhere in our source that sets colors for these, e.g. something resembling setAxisTitleColor(GRAY) to explain this phenomenon. Why they are black most of the time, I assume is some built-in default of Qwt.

    In order to fix our app, it'd be nice to write a line like setAxisTitleColor(BLACK) in the right place to force these labels to always be black. But there doesn't seem to be any such thing defined by Qwt. How to proceed? What does determine the label colors?

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

    Default Re: What determines color of text shown as axis label?

    Each QwtText object can have its individual color - if no color has been explicitely assigned the color is usually somehow taken from the widget palette where the QwtText object belongs to.

    In case of the title of a QwtScaleWidget it is scaleWidget->palette().color( QPalette::Text ). The tick labels are also painted with QPalette::Text, while ticks and the backbone of the axis are painted with QPalette::WindowText.

    Because of Qt3 compatibility Qwt 5.x uses the old names for these roles - check the code.


    PS: Note, that Qwt is open source. It is allowed to look into the code.

Similar Threads

  1. Replies: 0
    Last Post: 19th November 2010, 10:52
  2. Display Label Color by selecting Color Picker
    By sosanjay in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2009, 07:11
  3. Replies: 2
    Last Post: 30th June 2009, 18:08
  4. How to set which axis are shown?
    By Jeo_ in forum Qwt
    Replies: 1
    Last Post: 28th April 2009, 15:05
  5. Label text color
    By maverick_pol in forum Qt Programming
    Replies: 3
    Last Post: 27th February 2008, 10:49

Tags for this Thread


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.