Results 1 to 2 of 2

Thread: Style sheet related question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Style sheet related question

    Hi everyone,
    I am developing a User Interface where I have used style sheet for QLabel, QPushButton etc. For this I have created the qss files and then stored the style sheet information there. But the problem is I am using several QPushButton qss files to use them for different type of push buttons. Some of them have large text, some of them have different background and some of them have rounded edge. So now my question is, Is there any way to use the same qss file for these different types of QPushButton ? I mean can I use any logic in qss file so that it can dynamically change the style according to the button this file is called for?
    Thanks in advance.
    Pritimoy

  2. #2
    Join Date
    Mar 2010
    Posts
    69
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Style sheet related question

    Hi everyone,
    I got the answer. If you have a number of buttons with different features then you can use a single qss file to maintain the style sheet for all those. For that you have to use the following code;

    QPushButton[text = 'OK'] {
    color: green;
    }

    QPushButton[text = 'Cancel'] {
    color: blue;
    }

    Here in place of text you can use any unique feature or you can use the name of the object to show them in different styles.

    Hope this will help others.

Similar Threads

  1. Problems with Gradient style used through Style sheet on ARM platform
    By puneet.narsapur in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 25th January 2010, 12:48
  2. Slider Style sheet
    By sijithjames in forum Qt Programming
    Replies: 2
    Last Post: 30th December 2009, 12:43
  3. qt 4 color palette / style sheet question
    By killerwookie99 in forum Qt Programming
    Replies: 1
    Last Post: 6th November 2008, 23:05
  4. Style Sheet speed
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 24th January 2008, 18:40
  5. How to use style sheet
    By safknw in forum Qt Programming
    Replies: 1
    Last Post: 20th November 2006, 13:05

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
  •  
Qt is a trademark of The Qt Company.