diff options
author | André Nusser <andre.nusser@googlemail.com> | 2018-07-22 19:33:33 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2018-07-22 19:33:33 +0200 |
commit | 55965723f463cdd5ebfc0b493ac3ae317900fdee (patch) | |
tree | e23c35be21d8e4f09aa55b1785c64b79fa3a4a80 /plugingui/layout.cc | |
parent | d21d23af0958e82439425f545f5937e7a3559f53 (diff) |
Fix bug in GridLayout.
Diffstat (limited to 'plugingui/layout.cc')
-rw-r--r-- | plugingui/layout.cc | 13 |
1 files 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); } } |