PDA

View Full Version : QPrintDialog appearance



dair
20th July 2010, 14:23
Hi, I have a Qt 4.6.3 app using QPrintDialog on Windows 7. I've noticed that the contents of the QPrintDialog (and QPageSetupDialog) windows are using older "square" controls, rather than the Windows 7 theme.

I can't see anything in the Qt source which is requesting some kind of older theme, and they're both native dialogs (e.g., going through PrintDlgEx), so why is my app getting this older look?

Attached is an image from my app (what I have) and Notepad (what I'd like).

cydside
20th July 2010, 19:45
Did you have tried a setStyle("plastique"") from your QApplication?

dair
20th July 2010, 20:10
No, I don't change the global application style so it should be unchanged from the default native style.

I don't think that's relevant here though, as the print/page setup dialogs are native dialogs in 4.6.3 (so they're being drawn by Windows, not by Qt).

wysota
21st July 2010, 10:38
Can you reproduce this unexpected behaviour using a minimal example?

dair
21st July 2010, 11:54
The imageviewer sample app didn't show the problem, but that gave me a test case to compare against - thanks.

It turns out qmake automatically inserts a manifest request for Common Controls 6.0.0, which is what triggers the XP appearance vs the square "classic" look.

To do the same in an app that's not being built with qmake you need to include some extra information (http://qtcreator.blogspot.com/2009/10/xp-style-common-dialogs.html) in your manifest (slightly different setup for VS 2005 or later can be found here (http://www.mathies.com/weblog/?p=225)).