diff --git a/ui/toast/toast.cpp b/ui/toast/toast.cpp index b2016ba..5933d0a 100644 --- a/ui/toast/toast.cpp +++ b/ui/toast/toast.cpp @@ -87,6 +87,10 @@ void Instance::hide() { _widget->deleteLater(); } +void Instance::setInputUsed(bool used) { + _widget->setInputUsed(used); +} + not_null Instance::widget() const { return _widget.get(); } diff --git a/ui/toast/toast.h b/ui/toast/toast.h index 6c2a67c..2c0a2d5 100644 --- a/ui/toast/toast.h +++ b/ui/toast/toast.h @@ -56,6 +56,7 @@ public: void hideAnimated(); void hide(); + void setInputUsed(bool used); [[nodiscard]] not_null widget() const; private: diff --git a/ui/toast/toast_widget.cpp b/ui/toast/toast_widget.cpp index 0081af7..8978989 100644 --- a/ui/toast/toast_widget.cpp +++ b/ui/toast/toast_widget.cpp @@ -49,6 +49,12 @@ Widget::Widget(QWidget *parent, const Config &config) show(); } +void Widget::setInputUsed(bool used) { + setAttribute( + Qt::WA_TransparentForMouseEvents, + !used && !_text.hasLinks()); +} + void Widget::onParentResized() { updateGeometry(); } diff --git a/ui/toast/toast_widget.h b/ui/toast/toast_widget.h index 1ec5e97..493e5c5 100644 --- a/ui/toast/toast_widget.h +++ b/ui/toast/toast_widget.h @@ -21,6 +21,7 @@ public: // shownLevel=1 completely visible, shownLevel=0 completely invisible void setShownLevel(float64 shownLevel); + void setInputUsed(bool used); void onParentResized();