Results 1 to 2 of 2

Thread: Change background color of a QStackWidget

  1. #1
    Join Date
    Nov 2012
    Qt products

    Default Change background color of a QStackWidget

    In Qt 4.8, how would I change the background color of a QStackWidget? The trouble is that I have one of those over a QGLWidget, and it's showing up as just a black box. Worse, I put some labels in it with text, and that text is black, so they're effectively invisible. Is there a way to set the color of the QStackWidget, possibly with a level transparency? I found some references to something called a style sheet, but I'm not entirely clear how to use it. I've been using Qt Designer to make my UI, so I'm not sure where or how to call the setStyleSheet function.

    EDIT - I've found how to change the color in Qt Designer, but for some reason transparency is not working. I would set the backgroud gradient of a QStackWidget, and set an alpha of 100, but it still obscures everything behind it.
    Last edited by fiodis; 12th December 2012 at 00:15.

  2. #2
    Join Date
    Nov 2006
    Thanked 11 Times in 11 Posts
    Qt products
    Unix/X11 Windows

    Default Re: Change background color of a QStackWidget

    You can right click over QStackWidget and choose "Change Stylesheet"
    Choose "Add Color" --> Background-Color. You can change R, G, B, or alpha value from your widget with this method.

    Thank you,


Similar Threads

  1. Change background color of QPushButton
    By gtthang in forum Qt Programming
    Replies: 3
    Last Post: 26th November 2013, 11:23
  2. How to change the color of background of QMainwindow?
    By weixj2003ld in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2012, 00:56
  3. how to change background color of QMenu??
    By anupamgee in forum Qt Programming
    Replies: 3
    Last Post: 28th April 2009, 13:41
  4. how to change QTextEdit background color ?
    By mismael85 in forum Qt Programming
    Replies: 9
    Last Post: 26th June 2008, 23:05
  5. Change background color for a QPushButton?
    By Harvey West in forum Qt Programming
    Replies: 6
    Last Post: 5th January 2007, 15:23


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.