Fix title bar height of Aero wizard on Windows 8.

Windows 8 no longer allows for negative values to WM_NCCALCSIZE
to shrink the title bar.

Task-number: QTBUG-28435
Change-Id: I2e2e5e6aea9cc6781be4e9b06c9547e1e5ec86cb
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Friedemann Kleint 2012-12-12 11:22:36 +01:00 committed by The Qt Project
parent f5fd534603
commit 5fb6331a17
2 changed files with 17 additions and 4 deletions

View File

@ -271,6 +271,8 @@ QVistaHelper::~QVistaHelper()
void QVistaHelper::updateCustomMargins()
{
if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8)
return; // Negative margins are not supported on Windows 8.
if (QWindow *window = wizard->windowHandle()) {
// Reduce top frame to zero since we paint it ourselves.
const QMargins customMargins = vistaState() == VistaAero ?
@ -768,6 +770,19 @@ int QVistaHelper::titleOffset()
return leftMargin() + iconOffset;
}
int QVistaHelper::topOffset()
{
if (vistaState() != VistaAero)
return titleBarSize() + 3;
static const int aeroOffset =
QSysInfo::WindowsVersion == QSysInfo::WV_WINDOWS7 ?
QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
int result = aeroOffset;
if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8)
result += titleBarSize();
return result;
}
QT_END_NAMESPACE
#endif // QT_NO_STYLE_WINDOWSVISTA

View File

@ -105,10 +105,8 @@ public:
return int(QStyleHelper::dpiScaled(
QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
}
static int topOffset() {
static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); }
static int topOffset();
private:
static HFONT getCaptionFont(HANDLE hTheme);
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);