Results 1 to 10 of 10

Thread: why do buttons don't change color?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    54
    Thanked 2 Times in 2 Posts

    Unhappy why do buttons don't change color?

    Hi everyone.

    I'm using Qt4 on Windows and I'm encountering troubles with the buttons colors.
    Two questions I have:
    1) Even changing the QPalette::Button and QPalette::ButtonText colors of a QPushButton palette, why just the text gets changed and not the background? Do palettes support multiple changes? Here follows the piece of code which changes the palette:
    Qt Code:
    1. pal.setColor(QPalette::ButtonText, Qt::white);
    2. pal.setColor(QPalette::Button, Qt::black);
    3. ui.cmdsounddod->setPalette(pal);
    To copy to clipboard, switch view to plain text mode 

    2) To Qt developers: was this palette approach needed?
    Well, I mean, in Qt3 to change a color needed a call to
    Qt Code:
    1. uiobject->setBackgroundColor(QColor)
    To copy to clipboard, switch view to plain text mode 
    and now it needs to pass through the palette that I find a bit complex...
    I wouldn't be surprised if I miss a quicker way to change a ui object color...

    Thank you in advance,
    any help is appreciated
    Last edited by Raccoon29; 11th November 2007 at 23:04. Reason: spelling error
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 10:23
  2. Change QPushButton Background Color, Qt4.3
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2009, 07:14
  3. statusBar() message color change
    By mclark in forum Qt Programming
    Replies: 2
    Last Post: 7th August 2007, 23:20
  4. Replies: 2
    Last Post: 9th March 2007, 23:19
  5. [QTable] Change row's color
    By villy in forum Qt Programming
    Replies: 5
    Last Post: 15th November 2006, 19:21

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.