Can you tell me how to disable the compiler/codemodel warning for just one block of switch/case?
In general, I think it is very useful to be warned, but here it complains about 167 enumeration values not explicitly handled in the switch
.
I found this other question:
c++ warning: enumeration value not handled in switch [-Wswitch]
It says that you can get rid of the warning with default: break;
but in this case (recent QtCreator with clang) this does not apply.
I know I could change the code to if/else if/else if ..
but I expect the list of handled cases will grow with time, so I'd prefer to stay with switch/case
.
So, my question is, is there any keyword/macro/comment/attribute that says ignore the issue for just this single block?
The following code produces the warning, the other 167 values seem to be the possible return values of QEvent::type()
, which are part of Qt:
bool MyClass::event(QEvent * e) {
switch(e->type()) {
case QEvent::HoverEnter:
qDebug() << "enter";
return true;
case QEvent::HoverLeave:
qDebug() << "leave";
return true;
case QEvent::HoverMove:
qDebug() << "move";
return true;
default:
break;
}
return Piece::event(e);
}