Delete emote popup when it is closed.

This commit is contained in:
fourtf
2019-08-13 16:39:22 +02:00
parent 18f3a816ed
commit 7bf5a79f8a
6 changed files with 83 additions and 5 deletions
+2 -2
View File
@@ -100,8 +100,8 @@ namespace {
}
} // namespace
EmotePopup::EmotePopup()
: BaseWindow(nullptr, BaseWindow::EnableCustomFrame)
EmotePopup::EmotePopup(QWidget *parent)
: BaseWindow(parent, BaseWindow::EnableCustomFrame)
{
auto layout = new QVBoxLayout(this);
this->getLayoutContainer()->setLayout(layout);
+1 -1
View File
@@ -14,7 +14,7 @@ using ChannelPtr = std::shared_ptr<Channel>;
class EmotePopup : public BaseWindow
{
public:
EmotePopup();
EmotePopup(QWidget *parent = nullptr);
void loadChannel(ChannelPtr channel);
void loadEmojis();
+3 -1
View File
@@ -153,7 +153,9 @@ void SplitInput::openEmotePopup()
{
if (!this->emotePopup_)
{
this->emotePopup_ = std::make_unique<EmotePopup>();
this->emotePopup_ = new EmotePopup(this);
this->emotePopup_->setAttribute(Qt::WA_DeleteOnClose);
this->emotePopup_->linkClicked.connect([this](const Link &link) {
if (link.type == Link::InsertText)
{
+2 -1
View File
@@ -1,5 +1,6 @@
#pragma once
#include "util/QObjectRef.hpp"
#include "widgets/BaseWidget.hpp"
#include <QHBoxLayout>
@@ -46,7 +47,7 @@ private:
void openEmotePopup();
Split *const split_;
std::shared_ptr<EmotePopup> emotePopup_;
QObjectRef<EmotePopup> emotePopup_;
struct {
ResizingTextEdit *textEdit;