mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Added dummy filler to PeerQrBox when result link is empty.
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user