QWidget: use a static assert for a compile-time check

Change-Id: I48ec9afc7e5b01e833f66b7e893237d3c68ad048
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
bb10
Giuseppe D'Angelo 2014-12-24 14:18:56 +01:00
parent 462be988b6
commit 59d8310b05
1 changed files with 3 additions and 3 deletions

View File

@ -10915,9 +10915,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
return;
Q_D(QWidget);
Q_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8),
"QWidget::setAttribute(WidgetAttribute, bool)",
"QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute");
Q_STATIC_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8),
"QWidget::setAttribute(WidgetAttribute, bool): "
"QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute");
#ifdef Q_OS_WIN
// ### Don't use PaintOnScreen+paintEngine() to do native painting in some future release
if (attribute == Qt::WA_PaintOnScreen && on && windowType() != Qt::Desktop && !inherits("QGLWidget")) {