fix windows build when both whatsthis and tooltip are disabled

msvc produces warning there and it is treated as error

Pick-to: 6.0 5.15
Change-Id: Ic386df615df591fa1563b147342d670bbec771d2
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Nick Shaforostov 2021-02-02 18:26:49 +01:00
parent 9d19a8ca2f
commit 0ad434c2e9

View File

@ -369,10 +369,12 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event,
{ {
if (!event || !view) if (!event || !view)
return false; return false;
Q_D(QAbstractItemDelegate); Q_UNUSED(index);
Q_UNUSED(option);
switch (event->type()) { switch (event->type()) {
#if QT_CONFIG(tooltip) #if QT_CONFIG(tooltip)
case QEvent::ToolTip: { case QEvent::ToolTip: {
Q_D(QAbstractItemDelegate);
QHelpEvent *he = static_cast<QHelpEvent*>(event); QHelpEvent *he = static_cast<QHelpEvent*>(event);
const int precision = inherits("QItemDelegate") ? 10 : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp const int precision = inherits("QItemDelegate") ? 10 : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp
const QString tooltip = index.isValid() ? const QString tooltip = index.isValid() ?
@ -393,6 +395,7 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event,
event->setAccepted(index.data(Qt::WhatsThisRole).isValid()); event->setAccepted(index.data(Qt::WhatsThisRole).isValid());
break; break;
case QEvent::WhatsThis: { case QEvent::WhatsThis: {
Q_D(QAbstractItemDelegate);
QHelpEvent *he = static_cast<QHelpEvent*>(event); QHelpEvent *he = static_cast<QHelpEvent*>(event);
const int precision = inherits("QItemDelegate") ? 10 : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp const int precision = inherits("QItemDelegate") ? 10 : 6; // keep in sync with DBL_DIG in qitemdelegate.cpp
const QString whatsthis = index.isValid() ? const QString whatsthis = index.isValid() ?
@ -403,6 +406,7 @@ bool QAbstractItemDelegate::helpEvent(QHelpEvent *event,
break; break;
} }
#endif #endif
case QEvent::None:
default: default:
break; break;
} }