From 5e1e67277b4d7a2b0aebb7dfdbcd916fd8918fc9 Mon Sep 17 00:00:00 2001 From: LuK1337 Date: Fri, 9 Jul 2021 22:19:24 +0200 Subject: [PATCH] LibGUI: Remove left margin on MessageBox text when icon is unset It looks better when text is properly centered. --- Userland/Libraries/LibGUI/MessageBox.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp index 80f79234ca..3d366abbcb 100644 --- a/Userland/Libraries/LibGUI/MessageBox.cpp +++ b/Userland/Libraries/LibGUI/MessageBox.cpp @@ -92,14 +92,16 @@ void MessageBox::build() auto& message_container = widget.add(); message_container.set_layout(); - message_container.layout()->set_margins({ 8, 0, 0, 0 }); message_container.layout()->set_spacing(8); if (m_type != Type::None) { auto& icon_image = message_container.add(); icon_image.set_bitmap(icon()); - if (icon()) + if (icon()) { icon_width = icon()->width(); + if (icon_width > 0) + message_container.layout()->set_margins({ 8, 0, 0, 0 }); + } } auto& label = message_container.add