mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Fix crash in quiz explanation with spoilers.
This commit is contained in:
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/history_view_top_toast.h"
|
||||
|
||||
#include "ui/toast/toast.h"
|
||||
#include "core/ui_integration.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
||||
namespace HistoryView {
|
||||
@@ -27,8 +28,15 @@ InfoTooltip::InfoTooltip() = default;
|
||||
|
||||
void InfoTooltip::show(
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Main::Session*> session,
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback) {
|
||||
const auto context = [=](not_null<QWidget*> toast) {
|
||||
return Core::MarkedTextContext{
|
||||
.session = session,
|
||||
.customEmojiRepaint = [=] { toast->update(); },
|
||||
};
|
||||
};
|
||||
hide(anim::type::normal);
|
||||
_topToast = Ui::Toast::Show(parent, Ui::Toast::Config{
|
||||
.text = text,
|
||||
@@ -37,6 +45,7 @@ void InfoTooltip::show(
|
||||
.multiline = true,
|
||||
.dark = true,
|
||||
.slideSide = RectPart::Top,
|
||||
.textContext = context,
|
||||
});
|
||||
if (const auto strong = _topToast.get()) {
|
||||
if (hiddenCallback) {
|
||||
|
@@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "base/weak_ptr.h"
|
||||
|
||||
namespace Main {
|
||||
class Session;
|
||||
} // namespace Main
|
||||
|
||||
namespace Ui::Toast {
|
||||
class Instance;
|
||||
} // namespace Ui::Toast
|
||||
@@ -21,6 +25,7 @@ public:
|
||||
|
||||
void show(
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Main::Session*> session,
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback);
|
||||
void hide(anim::type animated);
|
||||
|
@@ -6765,7 +6765,11 @@ bool HistoryWidget::sendExistingPhoto(
|
||||
void HistoryWidget::showInfoTooltip(
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback) {
|
||||
_topToast.show(_scroll.data(), text, std::move(hiddenCallback));
|
||||
_topToast.show(
|
||||
_scroll.data(),
|
||||
&session(),
|
||||
text,
|
||||
std::move(hiddenCallback));
|
||||
}
|
||||
|
||||
void HistoryWidget::showPremiumStickerTooltip(
|
||||
|
@@ -1456,7 +1456,7 @@ void ListWidget::elementShowTooltip(
|
||||
const TextWithEntities &text,
|
||||
Fn<void()> hiddenCallback) {
|
||||
// Under the parent is supposed to be a scroll widget.
|
||||
_topToast.show(parentWidget(), text, hiddenCallback);
|
||||
_topToast.show(parentWidget(), &session(), text, hiddenCallback);
|
||||
}
|
||||
|
||||
bool ListWidget::elementAnimationsPaused() {
|
||||
|
Reference in New Issue
Block a user