PDA

View Full Version : Custom Window Title Buttons / Colors



Sven
27th September 2010, 08:47
Hello everyone,

I've got a question or well let's say im interesting in modifing my Qt Window. (such things as close button, maximize etc.)

I know , Qt has a lot of WindowStates/Flags but that's not what I am looking for. For example Google Chrome, they modify their whole window especially the title bar.

I don't know but I think the title bar is not drawn by Qt. It's a job for the underlying system (Windows, Unix etc.) isn't it?

So my question, do I have any possibilities to change the Window Title bar (with Qt)? Or could someone give me a hint how to do it?

(Example: Chrome with the color, Skype with another button and so on.)

Regards,

nish
27th September 2010, 09:00
You cant do anything with the title bar coz qt does not draw it. What you can do is that use FrameLessWindowHint (search for it in assistant) and then draw your own title bar. There are lot of examples on the net for that. There is even one in assistant which shows you how to implement mouse move events for a frameless window

Sven
27th September 2010, 09:12
Ok thanks, but how to implement those Vista / 7 Buttons - or Windows XP minimize, maximize and "x" ?

Do you think I've got the chance to draw those with the Windows API instead of drawing everything myself?

zack
27th September 2010, 09:45
There is even one in assistant which shows you how to implement mouse move events for a frameless window

What example do you mean?

Sven
27th September 2010, 09:56
I think he means this: http://doc.trolltech.com/4.5/widgets-windowflags.html

nish
27th September 2010, 10:13
What example do you mean?
this one .. qt-src-dir/examples/widgets/analogclock, and many others.

nish
27th September 2010, 10:15
Ok thanks, but how to implement those Vista / 7 Buttons - or Windows XP minimize, maximize and "x" ?

Do you think I've got the chance to draw those with the Windows API instead of drawing everything myself?

I guess you can get those icons through window api, but you have to draw them urself onto your widget. Better approach would be to have the icons as png(or any format u like) as an resource file. this way you dont have to worry about windows api and your application will have the same look on all platforms.

Sven
27th September 2010, 10:31
But thats not what I want. On Unix , i use the default Unix style but on Windows I want to use their Buttons (without having them as a PNG because of the hovering effects and so on).

Well I'll take a look into Windows WindowManager. Maybe there are some information about using these standard buttons and how to modify them. ;-)