Results 1 to 8 of 8

Thread: setting color of the text in qwtdial partially

  1. #1
    Join Date
    Jun 2015
    Location
    India
    Posts
    28
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default setting color of the text in qwtdial partially

    i can able to set the color of the text in qwt dial.
    but i need to set the color of the text partially.

    Example:
    if lowerbound is 0 and upperbound is 100

    i need the text color for 0 to 40 to be one color(say green)
    and text color for 40 to 100 to be another color(say blue)

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

    Default Re: setting color of the text in qwtdial partially

    Overload QwtRoundScaleDraw::label() and assign your derived class using QwtDial::setScaleDraw().
    By using QwtText::setColor() you can set individual color for a label.

    Uwe

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

    Navi (20th June 2015)

  4. #3
    Join Date
    Jun 2015
    Location
    India
    Posts
    28
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Smile Re: setting color of the text in qwtdial partially

    Quote Originally Posted by Uwe View Post
    Overload QwtRoundScaleDraw::label() and assign your derived class using QwtDial::setScaleDraw().
    By using QwtText::setColor() you can set individual color for a label.

    Uwe
    Thanks Uwe

    i need the color of dial also as two different colors
    like first half part of the dial as one color and remaining half of the dial as another color

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

    Default Re: setting color of the text in qwtdial partially

    Which parts of the dial - do you have a screenshot ?

    Uwe

  6. #5
    Join Date
    Jun 2015
    Location
    India
    Posts
    28
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: setting color of the text in qwtdial partially

    Untitled.png

    i have attached the image

  7. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: setting color of the text in qwtdial partially

    Again you can do it by overloading methods from QwtRoundScaleDraw - here drawBackbone(). You could use a gradient or draw the arc in segments with different pens.
    Have a look at the default implementations of QwtRoundScaleDraw, then it should be straightforward how to do it.

    Uwe

  8. The following user says thank you to Uwe for this useful post:

    Navi (21st June 2015)

  9. #7
    Join Date
    Jun 2015
    Location
    India
    Posts
    28
    Thanks
    7
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Android Maemo/MeeGo

    Default Re: setting color of the text in qwtdial partially

    Quote Originally Posted by Uwe View Post
    Again you can do it by overloading methods from QwtRoundScaleDraw - here drawBackbone(). You could use a gradient or draw the arc in segments with different pens.
    Have a look at the default implementations of QwtRoundScaleDraw, then it should be straightforward how to do it.

    Uwe
    I referred QwtRoundScaleDraw .but i couldn't understand..

    please can you give me example for drawBackbone in QwtRoundScaleDraw

  10. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,311
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: setting color of the text in qwtdial partially

    Qwt is open source - there is no better example than simply looking at the code.

    Uwe

Similar Threads

  1. Replies: 3
    Last Post: 16th July 2012, 15:04
  2. SETTING THE TEXT COLOR FOR QMessageBox
    By vinkakarun in forum Newbie
    Replies: 2
    Last Post: 5th November 2009, 16:32
  3. Setting color in a QTreeWidget text
    By brevleq in forum Qt Programming
    Replies: 4
    Last Post: 10th August 2007, 19:21
  4. setting text also changes color?
    By drhex in forum Qt Programming
    Replies: 5
    Last Post: 22nd November 2006, 16:36
  5. Setting text color on QLabel
    By Yorma in forum Newbie
    Replies: 11
    Last Post: 15th June 2006, 07:25

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.