Results 1 to 20 of 28

Thread: QPushbutton background color

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: QPushbutton background color

    even if the above code is correct, but... nothing happend

    and this is my solution : I create a red .png - for exemple - with "MacromediaFireWorks" ,
    I convert it to .ico and it's work with this code :

    ui.pushButton->setIcon(QIcon("./icon/28.ico"));

    thanks to all

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: QPushbutton background color

    it's not a solution. it's woraround. you have to find a problem.

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: QPushbutton background color

    try to de the next thing, open Qt Designer, create a widget and put on it a QPushButton and play with a palette settings of this button. what will you see?

  4. #4
    Join Date
    Jul 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: QPushbutton background color

    I dont see any thing
    it's a temporary solution

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: QPushbutton background color

    did you do this in designer and color of button did not change?
    ps. packed by 7zip
    Attached Files Attached Files

  6. #6
    Join Date
    Jul 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: QPushbutton background color

    I did the same..
    even on the pallette all other controls change color except button

  7. #7
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: QPushbutton background color

    rebuild Qt and try again

  8. #8
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: QPushbutton background color

    omega36, what version of Qt are you using?

  9. #9
    Join Date
    Jul 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: QPushbutton background color

    Quote Originally Posted by spirit View Post
    rebuild Qt and try again


    I use Qt4.2.2

  10. #10
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: QPushbutton background color

    maybe it's a bug in this version. anyway, did you try to run this code on another version of Qt?

  11. #11
    Join Date
    Jul 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: QPushbutton background color

    Quote Originally Posted by spirit View Post
    maybe it's a bug in this version. anyway, did you try to run this code on another version of Qt?
    ....

    No I can't, I must use Qt4.2.2

  12. #12
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: QPushbutton background color

    in this case, it is not necessary to create an image using an image editor and then load it. you can create an QPixmap in your program and then use it.

  13. #13
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: QPushbutton background color

    omega36, Do you have a chance to try Qt 4.3 or 4.4?

  14. #14
    Join Date
    Jul 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: QPushbutton background color

    Quote Originally Posted by omega36 View Post
    even if the above code is correct, but... nothing happend

    and this is my solution : I create a red .png - for exemple - with "MacromediaFireWorks" ,
    I convert it to .ico and it's work with this code :

    ui.pushButton->setIcon(QIcon("./icon/28.ico"));

    thanks to all

    yes.. done

    thank u very much

  15. #15
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: QPushbutton background color

    I'm talking about this
    Qt Code:
    1. ....
    2. QPixmap pixmap(width, height);
    3. pixmap.fill(Qt::red);
    4. QIcon icon(pixmap);
    5. ...
    To copy to clipboard, switch view to plain text mode 

  16. #16
    Join Date
    Jul 2008
    Posts
    40
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: QPushbutton background color

    sorry I read it quickly
    ok that is better

Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 11:23
  2. Change QPushButton Background Color, Qt4.3
    By Rayven in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2009, 08:14
  3. How to change color of a QPushButton?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 5th March 2008, 14:22
  4. Change background color for a QPushButton?
    By Harvey West in forum Qt Programming
    Replies: 6
    Last Post: 5th January 2007, 15:23
  5. QLabel background color
    By munna in forum Newbie
    Replies: 3
    Last Post: 1st May 2006, 16:36

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.