Added dummy filler to PeerQrBox when result link is empty.

This commit is contained in:
23rd
2025-11-24 16:05:42 +03:00
parent e97ae3d537
commit 669c581701
+17 -1
View File
@@ -261,7 +261,7 @@ not_null<Ui::RpWidget*> 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<Ui::RpWidget*> 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(),