From 55965723f463cdd5ebfc0b493ac3ae317900fdee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Nusser?= Date: Sun, 22 Jul 2018 19:33:33 +0200 Subject: Fix bug in GridLayout. --- plugingui/layout.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/plugingui/layout.cc b/plugingui/layout.cc index da64d1b..f38bc20 100644 --- a/plugingui/layout.cc +++ b/plugingui/layout.cc @@ -370,15 +370,10 @@ void GridLayout::moveAndResize( } else { - if(item.width() <= width && item.height() <= height) - { - item.move(x + (width - item.width()) / 2, - y + (height - item.height()) / 2); - } - else - { - item.move(x, y); - } + auto x_new = (item.width() > width) ? x : x + (width - item.width()) / 2; + auto y_new = (item.height() > height) ? y : y + (height - item.height()) / 2; + + item.move(x_new, y_new); } } -- cgit v1.2.3