Results 1 to 4 of 4

Thread: Qt stylesheet QPushButon example

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Location
    Zawiercie, Poland
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Qt stylesheet QPushButon example

    Hello everybody.

    Could anyone who knows perfect stylesheets can give me a little example of setting standard icons in stylesheet on QPushbutton?

    I try used something like this but this doesn't work:
    Qt Code:
    1. font: 75 28pt \"Serif\";
    2. background-color: BROWN;
    3. icon-size: 32px;
    4. border-image: backward-icon;
    5. }
    To copy to clipboard, switch view to plain text mode 

    First: I don't know how to use default icons from Qt in stylesheets and I'm weak with styles, so please forgive me.
    Second: I want to have a button which will blinking in other color when it has a focus.
    To do this I used simple method - setting background-color in stylesheet and QTimer timeout signal.
    Is there are better way to achive this?

    Please can somebody give me an example of using standard icons (theese from QStyle) in stylesheets?

    Thank you.
    Regards.

  2. #2
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    85
    Thanks
    2
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt stylesheet QPushButon example

    Try different values "0 -75 0 0" and "padding-left: 75px"
    Qt Code:
    1. "QPushButton {"
    2. "font: 75 28pt \"Serif\";"
    3. "background-color: BROWN;"
    4. "border-image: url(:images/image.png) 0 -75 0 0;"
    5. "padding-left: 75px;"
    6. "}"
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. stylesheet
    By BalaQT in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2010, 07:45
  2. Stylesheet for ActionsContextMenu - how to?
    By QPlace in forum Qt Programming
    Replies: 5
    Last Post: 21st August 2009, 14:51
  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

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.