From 44f0f81d5d38e7137c1d11fd04cb502f8ea614b9 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 2 Jun 2022 13:50:47 +0300 Subject: [PATCH] Fixed QPainter warnings in line from premium limits boxes. --- .../ui/effects/premium_graphics.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp index 33f3b8294..40b1e6125 100644 --- a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp +++ b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp @@ -474,6 +474,9 @@ Line::Line( sizeValue( ) | rpl::start_with_next([=](const QSize &s) { + if (s.isEmpty()) { + return; + } _leftWidth = (s.width() / 2); _rightWidth = (s.width() - _leftWidth); recache(s); @@ -620,12 +623,6 @@ void AddAccountsRow( const auto state = container->lifetime().make_state(); const auto group = args.group; - group->setChangedCallback([=](int value) { - for (auto i = 0; i < state->accounts.size(); i++) { - state->accounts[i].checkbox.setChecked(i == value); - } - }); - const auto imageRadius = args.st.imageRadius; const auto checkSelectWidth = args.st.selectWidth; const auto nameFg = args.stNameFg; @@ -675,7 +672,9 @@ void AddAccountsRow( .name = std::move(name), }); const auto index = int(state->accounts.size()) - 1; - state->accounts[index].checkbox.setChecked(index == group->value()); + state->accounts[index].checkbox.setChecked( + index == group->value(), + anim::type::instant); widget->paintRequest( ) | rpl::start_with_next([=] { @@ -733,6 +732,12 @@ void AddAccountsRow( photoWidth))); } }, container->lifetime()); + + group->setChangedCallback([=](int value) { + for (auto i = 0; i < state->accounts.size(); i++) { + state->accounts[i].checkbox.setChecked(i == value); + } + }); } QGradientStops LimitGradientStops() {