Results 1 to 3 of 3

Thread: qcolor reverse lighter

  1. #1
    Join Date
    Nov 2009
    Location
    San Antonio, TX
    Posts
    69
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows

    Default qcolor reverse lighter

    I have a QGraphicsRectitem that I want to highlight by changing the color of the pen when you enter the item and change it back when you leave. The rect can have various colors. I am trying to use the setPen(pen().color().lighter(150)) in the enter event and setPen(pen().color.darker(200)) in the leave event, but the darker does not reproduce the original color and eventually the rect becomes black after entering/leaving enough times. Is there a way to truly reverse the effects of the lighter function? Is it best to just use two internal color variables?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: qcolor reverse lighter

    Why two ? Just original (when item is not "entered") pen color will be enough:
    Qt Code:
    1. setPen(this->_color.lighter(150));// in the enter event
    2. setPen(this->_color); //in the leave event
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Nov 2009
    Location
    San Antonio, TX
    Posts
    69
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt Jambi
    Platforms
    Unix/X11 Windows

    Default Re: qcolor reverse lighter

    Oh, that is true . . . good idea . . . thanks

Similar Threads

  1. Qt pointer moves in reverse with tslib
    By alsaleem in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 11th January 2011, 21:16
  2. Reverse engineering tools
    By vvbkumar in forum General Programming
    Replies: 4
    Last Post: 29th September 2010, 17:48
  3. can Qt darker / lighter a image ?
    By wesley in forum Qt Programming
    Replies: 3
    Last Post: 27th January 2010, 07:56
  4. Reverse engineering of ui-file
    By wallyqt in forum Qt Tools
    Replies: 5
    Last Post: 18th November 2007, 22:11
  5. Reverse Order on QStringList slow...?
    By patrik08 in forum Qt Programming
    Replies: 24
    Last Post: 21st February 2007, 09:32

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.