Results 1 to 7 of 7

Thread: Tool button problem

  1. #1
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Tool button problem

    Hi All,
    I've a tool button, it is implimented in a class. and i'm creating the object of tool button in mainwindow class. And the back ground color of tool button is of rgb 128,128,128. I need to fade the color if it is disabled. I did like below.

    Qt Code:
    1. button->disableToolButton(true);
    2. button->setStylesheey("background color : QColor(140,140,140)");
    To copy to clipboard, switch view to plain text mode 


    But its not working. Any suggestion, how to achieve it??

    N.B : I'm overriding the paintevent of QtoolButton, in my toolbutton class.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tool button problem

    Does it work with the standard QToolButton class?
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tool button problem

    Are you using same spelling ( stylesheey) in code ?
    Try this -
    button->setStyleSheet("background color : rgb140,140,140)");
    Style sheets doesnt know about QColor !!

  4. #4
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Tool button problem

    Quote Originally Posted by aamer4yu View Post
    Are you using same spelling ( stylesheey) in code ?
    Try this -


    Style sheets doesnt know about QColor !!
    no , i'm using stylesheet .

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Tool button problem

    Your syntax is corrupt:
    css Code:
    1. background-color: #8C8C8C;
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Tool button problem

    no , i'm using stylesheet .
    I didnt just point about the spelling mistake,,, it was also you are using QColor in stylesheet,,, while you should use rgb instead !

  7. #7
    Join Date
    Oct 2009
    Posts
    105
    Thanked 4 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Tool button problem

    Quote Originally Posted by aamer4yu View Post
    I didnt just point about the spelling mistake,,, it was also you are using QColor in stylesheet,,, while you should use rgb instead !
    Actually my requirement is, to disable the toolbutton, text and image placed on top of the button. so that it's color will be fade.
    How to do it.

Similar Threads

  1. Custom QStyle: change only tool button text color
    By Lykurg in forum Qt Programming
    Replies: 0
    Last Post: 27th February 2009, 19:55
  2. How to add a tool button to a qlistview header
    By kalos80 in forum Qt Programming
    Replies: 2
    Last Post: 31st July 2008, 10:13
  3. Problem with unified tool bar on Mac OS X
    By m_e in forum Qt Programming
    Replies: 1
    Last Post: 7th August 2007, 11:21
  4. problem with Tool button n Layout
    By arjunasd in forum Qt Tools
    Replies: 11
    Last Post: 24th July 2007, 21:14
  5. Facing problem with tool bar icons
    By jnana in forum Qt Programming
    Replies: 4
    Last Post: 20th April 2006, 08:37

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.