From 612202a7a569268be18ae4f2e06ff05fef759d0a Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 31 Jul 2014 14:33:12 +0200 Subject: [PATCH] fixed several bugs in the layout algorithm of the toggle scene tool --- apps/opencs/view/widget/scenetooltoggle.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/opencs/view/widget/scenetooltoggle.cpp b/apps/opencs/view/widget/scenetooltoggle.cpp index b940a5cb0d..07c448e453 100644 --- a/apps/opencs/view/widget/scenetooltoggle.cpp +++ b/apps/opencs/view/widget/scenetooltoggle.cpp @@ -92,7 +92,7 @@ QRect CSVWidget::SceneToolToggle::getIconBox (int index) const { // space out icons vertically, if there aren't enough to populate all rows int diff = yMax - actualYIcons; - yBorder += (diff*(yBorder+iconXSize)) / actualYIcons; + yBorder += (diff*(yBorder+iconXSize)) / (actualYIcons+1); } if (y==actualYIcons-1) @@ -100,12 +100,12 @@ QRect CSVWidget::SceneToolToggle::getIconBox (int index) const // generating the last row of icons int actualXIcons = total % xMax; - if (actualYIcons) + if (actualXIcons) { // space out icons horizontally, if there aren't enough to fill the last row - int diff = xMax - actualYIcons; + int diff = xMax - actualXIcons; - xBorder += (diff*(xBorder+iconYSize)) / actualXIcons; + xBorder += (diff*(xBorder+iconXSize)) / (actualXIcons+1); } }