From 82d2ac08712e3f49427a4c79cd7aeebf18bca833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 8 Aug 2021 11:07:53 +0200 Subject: [PATCH] Fixed layout centering --- src/GUI/flowlayout.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/GUI/flowlayout.cpp b/src/GUI/flowlayout.cpp index 025f8897..8b645592 100644 --- a/src/GUI/flowlayout.cpp +++ b/src/GUI/flowlayout.cpp @@ -147,8 +147,9 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const if (!testOnly) { for (int i = 0; i < rows.size(); i++) { const FlowLayoutItem &li = rows.at(i).last(); - int width = li.item->sizeHint().width() + li.pos.x(); - int offset = (rect.width() - width) / 2; + int width = li.item->sizeHint().width() + li.pos.x() + - effectiveRect.x(); + int offset = (effectiveRect.width() - width) / 2; int height = 0; for (int j = 0; j < rows.at(i).size(); j++)