path: root/src/widgets
diff options
authorMarc Mutz <>2016-10-10 21:02:16 +0200
committerMarc Mutz <>2016-10-12 09:08:38 +0000
commitde48fd192b7973c4849ec79bce4cd491b5e8550f (patch)
tree18c05bb98b556babe80eef1bd41e282e8bb81cb6 /src/widgets
parent00304a3d57b9ba33b6a253b8736cf7e15aeac5c3 (diff)
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 <>
Diffstat (limited to 'src/widgets')
1 files changed, 6 insertions, 1 deletions
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index 16b1115dd6..f42c1f0ed9 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -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 - pos.y();
- default:
+ break;
+ case QInternal::DockCount:
return -1;