Results 1 to 2 of 2

Thread: Don't u nderstand how to use the palette in Qt Designer

  1. #1
    Join Date
    Aug 2016
    Posts
    4
    Qt products
    Platforms
    Unix/X11 Windows

    Default Don't u nderstand how to use the palette in Qt Designer

    Can someone link me to an explanation of what the different palette elements do and under what circumstances certain palette elements might or might be available/applicable. I'm having a very hard time doing something as simple as changing the background colour of a button when its active/disabled. However, there's no problem changing the button text for active/inactive. Whats the difference (should there be?) between running my program on windows and on my target embedded system. Does it have something to do with styles? If so how do I change the style on windows so its reflects the style I'm using (but haven't explicitly set) on my Raspberry Pi using PyQt4? Thanks.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Don't u nderstand how to use the palette in Qt Designer

    Reading the documentation for QPalette, especially QPalette::ColorRole and QPalette::ColorGroup should answer a lot of questions.

    In C++ at least, QPalette is typically used like this:

    Qt Code:
    1. QPushButton * myButton = new QPushButton( this );
    2. QPalette pal = myButton->palette();
    3.  
    4. pal.setColor( QPalette::Disabled, QPalette::Button, Qt::gray );
    5.  
    6. myButton->setPalette( pal );
    To copy to clipboard, switch view to plain text mode 

    The default styles used on the RPi and desktop will almost certainly be different. Again, the documentation for QStyle explains this, and gives an example of how you can start an app with a different style than the default on the platform where you are running it.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 1
    Last Post: 19th March 2014, 23:25
  2. Problems with the palette on the Mac
    By JohnGaby in forum Qt Programming
    Replies: 0
    Last Post: 6th March 2010, 14:59
  3. Palette toolbar
    By Radagast in forum Qt Programming
    Replies: 8
    Last Post: 7th July 2008, 18:56
  4. Qt 4.4 PaintContext palette
    By bunjee in forum Qt Programming
    Replies: 0
    Last Post: 14th May 2008, 13:53
  5. Setting QFrame palette in Designer doesn't "stick"
    By Doug Broadwell in forum Qt Tools
    Replies: 1
    Last Post: 9th September 2007, 22:44

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.