tags:

views:

408

answers:

3

Does anybody know how can I customize title bar of a main window in QT? I would like to make some custom painting over the "normal" drawing.

The QT version I'm interested in is 4.5 or 4.6 (beta)

A: 

Hey,

Try to have a look at Style sheets... There are examples about how to customize a QDockWidget's title bar in QtAssistant... (Look for "Style sheet" then choose "Customizing QDockWidget" in the tree)...

If you don't find anything, maybe by reimplementing QMainwindow ?

Hope this helps a bit...

Andy M
I want to avoid reimplementing QMainWindow. And styles and style sheets offer no support for main window caption bars.
Cătălin Pitiș
+4  A: 

Actually, the title bar is a part of what the "window manager" adds. This could be Windows, OS X or whatever you are running in your X11 environment. Either way, you need to remove the bar and replace it with one of your own. To do this, use the Qt::WindowFlags (http://doc.trolltech.com/4.5/qt.html#WindowType-enum) to make the titlebar go away. This does, however, make your application sensitive to platforms and, on X11, window manager. You can only hint that you want to have a window without a titlebar...

e8johan
I tried to avoid that... but I see no other choice than to do as you said.
Cătălin Pitiș
+1  A: 

It seems you are looking for QSkinObject from Kernel_Panic:

http://www.qt-apps.org/content/show.php?action=content&content=67309

Works quite good the few times I tested it.

elcuco