Remove qobject_cast to QDockWidget in QWindowsVistaStyle.

Rearrange checks in handling of CE_DockWidgetTitle
to be consistent with the other styles.

Task-number: QTBUG-37350

Change-Id: I8f5d11092eff96337ff1e685d3c42fbb2f128827
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
Friedemann Kleint 2014-03-25 11:47:16 +01:00 committed by The Qt Project
parent 0ff6f175ec
commit 5e6697bf20

View File

@ -1421,15 +1421,14 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
}
break;
case CE_DockWidgetTitle:
if (const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(widget)) {
if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
const QDockWidget *dockWidget = qobject_cast<const QDockWidget *>(widget);
QRect rect = option->rect;
if (dockWidget->isFloating()) {
if (dockWidget && dockWidget->isFloating()) {
QWindowsXPStyle::drawControl(element, option, painter, widget);
break; //otherwise fall through
}
if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
const QStyleOptionDockWidgetV2 *v2
= qstyleoption_cast<const QStyleOptionDockWidgetV2*>(dwOpt);
bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
@ -1490,7 +1489,6 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
}
}
break;
}
#ifndef QT_NO_ITEMVIEWS
case CE_ItemViewItem:
{