QToolBarAreaLayoutInfo: add missing break statements in switch in distance()

A fall-through here is logically non-sensical, because of symmetry (or
lack thereof). Thus, a break must have been intended.

Add it.

While we're at it, also replace the default case label with the
non-functional enum value QInternal::DockCount, so that -Wswitch can
warn us if ever there should be a new DockPosition.

Found independently by both GCC 7 and Coverity.

Coverity-Id: 11145
Coverity-Id: 11146
Coverity-Id: 11147
Change-Id: I6bb31c1517e40f0cb06ceaee5aeb6fa78b84a523
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Marc Mutz 2016-10-10 21:02:16 +02:00
parent 00304a3d57
commit de48fd192b
1 changed files with 6 additions and 1 deletions

View File

@ -598,16 +598,21 @@ int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const
case QInternal::LeftDock:
if (pos.y() < rect.bottom())
return pos.x() - rect.right();
break;
case QInternal::RightDock:
if (pos.y() < rect.bottom())
return rect.left() - pos.x();
break;
case QInternal::TopDock:
if (pos.x() < rect.right())
return pos.y() - rect.bottom();
break;
case QInternal::BottomDock:
if (pos.x() < rect.right())
return rect.top() - pos.y();
default:
break;
case QInternal::DockCount:
break;
}
return -1;