Results 1 to 2 of 2

Thread: Prblem in stylesheet.

  1. #1
    Join Date
    May 2011
    Posts
    120
    Thanks
    9
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Prblem in stylesheet.

    Hi

    I am changing the stylesheet of button like , it is working fine

    Qt Code:
    1. button_out->setStyleSheet("color: rgb(200, 127, 66, 255);
    2. font-family: verdana, ms sans serif; font-size: 14pt;
    3. background-color: rgb(203, 202, 203,150);
    4. border-style: outset;border-width: 2px;border-radius: 10px;
    5. border-color: gray");
    To copy to clipboard, switch view to plain text mode 
    to change stylesheet on button press it is not giving the desire output.

    Qt Code:
    1. button_out->setStyleSheet("color: rgb(200, 127, 66, 255);
    2. font-family: verdana, ms sans serif; font-size: 14pt;
    3. background-color: rgb(203, 202, 203,150);
    4. border-style: outset;border-width: 2px;
    5. border-radius: 10px;border-color: gray;
    6. QPushButton:pressed{ background-color:black}");
    To copy to clipboard, switch view to plain text mode 


    What is the problem with this.
    Waiting for your reply.

  2. #2
    Join Date
    Feb 2010
    Location
    Sydney, Australia
    Posts
    111
    Thanks
    18
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Prblem in stylesheet.

    This should work:

    Qt Code:
    1. button_out->setStyleSheet("QPushButton { color: rgb(200, 127, 66, 255); font-family: verdana, ms sans serif; \
    2. font-size: 14pt; background-color: rgb(203, 202, 203,150); border-style: outset; \
    3. border-width: 2px;border-radius: 10px; border-color: gray; } QPushButton:pressed { background-color:black; } ");
    To copy to clipboard, switch view to plain text mode 

    Rather than setting the stylesheet in this way, on a per-component basis, I highly recommend looking at using a system-wide stylesheet (QSS). See Qt Stylesheet Reference.

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

    Niamita (21st June 2011)

Similar Threads

  1. stylesheet
    By BalaQT in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2010, 07:45
  2. Prblem in Building and running Examples.
    By Tarun in forum Qt Programming
    Replies: 1
    Last Post: 21st January 2010, 13:45
  3. Qt Stylesheet
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 22nd January 2009, 14:48
  4. How to do this with StyleSheet
    By yxmaomao in forum Qt Programming
    Replies: 5
    Last Post: 30th May 2008, 08:54
  5. stylesheet
    By phillip_Qt in forum Qt Programming
    Replies: 11
    Last Post: 27th April 2008, 19:11

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.