From 669c5817015a0ca2fc38133b622ff12f58708074 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 24 Nov 2025 16:05:42 +0300 Subject: [PATCH] Added dummy filler to PeerQrBox when result link is empty. --- Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp b/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp index 57c075cab6..3cbac5a47e 100644 --- a/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/peer_qr_box.cpp @@ -261,7 +261,7 @@ not_null PrepareQrWidget( state->backgroundColors = backgroundColors; state->text = username.toUpper(); state->textWidth = state->font->width(state->text); - { + if (!link.isEmpty()) { const auto remainder = qrMaxSize % st::introQrPixel; const auto downTo = remainder ? qrMaxSize - remainder @@ -274,6 +274,13 @@ not_null PrepareQrWidget( Size(qrMaxSize * style::DevicePixelRatio()), Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + } else { + auto image = QImage( + Size(qrMaxSize * style::DevicePixelRatio()), + QImage::Format_ARGB32_Premultiplied); + image.fill(Qt::white); + image.setDevicePixelRatio(style::DevicePixelRatio()); + state->qrImage = std::move(image); } const auto resultWidth = qrMaxSize + rect::m::sum::h(state->backgroundMargins); @@ -475,6 +482,15 @@ void FillPeerQrBox( p.drawImage(0, 0, userpicMedia->image(userpicSize)); }, userpic->lifetime()); + linkValue() | rpl::start_with_next([=](const QString &link) { + if (link.isEmpty()) { + box->showFinishes() | rpl::start_with_next([=] { + box->closeBox(); + }, box->lifetime()); + box->closeBox(); + } + }, box->lifetime()); + userpic->setVisible(peer != nullptr); PrepareQrWidget( box->verticalLayout(),