Results 1 to 4 of 4

Thread: How to use system colors in QToolBar?

  1. #1
    Join Date
    Jul 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question How to use system colors in QToolBar?

    For example, in ubuntu gtk apps has a black toolbar. I'm trying to create a qt app, but QToolbar doesnt use system color(in this case, black). So how can I make QToolBar to use system color? If this is impossible, how can I get the title bar's color(to make toolbars background color)? And I found something for mac to make compatible titlebar and toolbars: "setUnifiedTitleAndToolBarOnMac(true)". Is there a equivalent thing for ubuntu/unity/gtk desktops?

  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: How to use system colors in QToolBar?

    QToolBar is derived from QWidget, so you should be able to retrieve the QPalette, set the QPalette::Window role to the color you want, then set the palette back on the toolbar. Alternatively, you could apply a style sheet to the toolbar.

    If you aren't setting the window (background) color, then the widget is using the system color, as given by QApplication::palette(). So if the background isn't black as you expect, it is because the application doesn't think it should be.

  3. #3
    Join Date
    Jul 2010
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to use system colors in QToolBar?

    I know I can set backgroundcolor to widget but I want it to use with system colors. It seems there is no way to use system colors in toolbars like gtk apps. So, how can I get the title bar's color? Is there any way to do that?

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to use system colors in QToolBar?

    This could be a style issue.
    Maybe your application is not using the GTK integration style.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 10th October 2013, 15:08
  2. How to set colors in arraylist?
    By naufalahad in forum Qt Programming
    Replies: 9
    Last Post: 28th November 2011, 14:56
  3. Replies: 8
    Last Post: 21st March 2011, 12:40
  4. how to use System Tray Icons in QToolBar
    By wagmare in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2009, 15:52
  5. row colors
    By nategoofs in forum Qt Programming
    Replies: 3
    Last Post: 17th August 2007, 19:16

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.