From 283cb25dfdea09cbd3cd49410adf473ca0481b52 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 2 May 2022 07:57:52 +0400 Subject: [PATCH] Allow creating SeparatePanel with a parent. --- ui/widgets/separate_panel.cpp | 5 +++-- ui/widgets/separate_panel.h | 26 +++++++++++++------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/ui/widgets/separate_panel.cpp b/ui/widgets/separate_panel.cpp index 9cfcbb4..8f916ea 100644 --- a/ui/widgets/separate_panel.cpp +++ b/ui/widgets/separate_panel.cpp @@ -27,8 +27,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Ui { -SeparatePanel::SeparatePanel() -: _close(this, st::separatePanelClose) +SeparatePanel::SeparatePanel(QWidget *parent) +: RpWidget(parent) +, _close(this, st::separatePanelClose) , _back(this, object_ptr(this, st::separatePanelBack)) , _body(this) { setMouseTracking(true); diff --git a/ui/widgets/separate_panel.h b/ui/widgets/separate_panel.h index 49a5ab8..6758be3 100644 --- a/ui/widgets/separate_panel.h +++ b/ui/widgets/separate_panel.h @@ -25,9 +25,9 @@ class FadeWrapScaled; namespace Ui { -class SeparatePanel final : public Ui::RpWidget { +class SeparatePanel final : public RpWidget { public: - SeparatePanel(); + explicit SeparatePanel(QWidget *parent = nullptr); void setTitle(rpl::producer title); void setInnerSize(QSize size); @@ -37,10 +37,10 @@ public: void showAndActivate(); int hideGetDuration(); - void showInner(base::unique_qptr inner); + void showInner(base::unique_qptr inner); void showBox( - object_ptr box, - Ui::LayerOptions options, + object_ptr box, + LayerOptions options, anim::type animated); void showToast(const TextWithEntities &text); void destroyLayer(); @@ -83,12 +83,12 @@ private: void finishAnimating(); void finishClose(); - object_ptr _close; - object_ptr _title = { nullptr }; - object_ptr> _back; - object_ptr _body; - base::unique_qptr _inner; - base::unique_qptr _layer = { nullptr }; + object_ptr _close; + object_ptr _title = { nullptr }; + object_ptr> _back; + object_ptr _body; + base::unique_qptr _inner; + base::unique_qptr _layer = { nullptr }; rpl::event_stream<> _synteticBackRequests; rpl::event_stream<> _userCloseRequests; rpl::event_stream<> _closeEvents; @@ -101,10 +101,10 @@ private: QPoint _dragStartMousePosition; QPoint _dragStartMyPosition; - Ui::Animations::Simple _titleLeft; + Animations::Simple _titleLeft; bool _visible = false; - Ui::Animations::Simple _opacityAnimation; + Animations::Simple _opacityAnimation; QPixmap _animationCache; QPixmap _borderParts;