diff --git a/src/widgets/helper/ResizingTextEdit.cpp b/src/widgets/helper/ResizingTextEdit.cpp index a26909a64..40bc66b02 100644 --- a/src/widgets/helper/ResizingTextEdit.cpp +++ b/src/widgets/helper/ResizingTextEdit.cpp @@ -25,7 +25,6 @@ ResizingTextEdit::ResizingTextEdit() [this] { this->completionInProgress_ = false; }); this->setFocusPolicy(Qt::ClickFocus); - setAcceptDrops(true); } QSize ResizingTextEdit::sizeHint() const @@ -280,29 +279,6 @@ void ResizingTextEdit::insertFromMimeData(const QMimeData *source) } } -void ResizingTextEdit::dragEnterEvent(QDragEnterEvent *event) -{ - if (event->mimeData()->hasImage() || event->mimeData()->hasUrls()) - { - event->acceptProposedAction(); - } - else - { - QTextEdit::dragEnterEvent(event); - } -} - -void ResizingTextEdit::dropEvent(QDropEvent *event) -{ - if (event->mimeData()->hasImage() || event->mimeData()->hasUrls()) - { - this->imagePasted.invoke(event->mimeData()); - } - else - { - QTextEdit::dropEvent(event); - } -} QCompleter *ResizingTextEdit::getCompleter() const { return this->completer_; diff --git a/src/widgets/helper/ResizingTextEdit.hpp b/src/widgets/helper/ResizingTextEdit.hpp index 018d345f9..cd1db3114 100644 --- a/src/widgets/helper/ResizingTextEdit.hpp +++ b/src/widgets/helper/ResizingTextEdit.hpp @@ -34,9 +34,6 @@ protected: bool canInsertFromMimeData(const QMimeData *source) const override; void insertFromMimeData(const QMimeData *source) override; - void dragEnterEvent(QDragEnterEvent *event) override; - void dropEvent(QDropEvent *event) override; - private: // hadSpace is set to true in case the "textUnderCursor" word was after a // space diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 9983a65cb..66ee22324 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -211,6 +211,7 @@ Split::Split(QWidget *parent) [this](const QMimeData *source) { upload(source, this->getChannel(), *this->input_->ui_.textEdit); }); + setAcceptDrops(true); } Split::~Split() @@ -689,6 +690,29 @@ void Split::reloadChannelAndSubscriberEmotes() } } +void Split::dragEnterEvent(QDragEnterEvent *event) +{ + if (event->mimeData()->hasImage() || event->mimeData()->hasUrls()) + { + event->acceptProposedAction(); + } + else + { + BaseWidget::dragEnterEvent(event); + } +} + +void Split::dropEvent(QDropEvent *event) +{ + if (event->mimeData()->hasImage() || event->mimeData()->hasUrls()) + { + this->input_->ui_.textEdit->imagePasted.invoke(event->mimeData()); + } + else + { + BaseWidget::dropEvent(event); + } +} template static Iter select_randomly(Iter start, Iter end, RandomGenerator &g) { diff --git a/src/widgets/splits/Split.hpp b/src/widgets/splits/Split.hpp index edfca352e..56d21053e 100644 --- a/src/widgets/splits/Split.hpp +++ b/src/widgets/splits/Split.hpp @@ -86,6 +86,9 @@ protected: void leaveEvent(QEvent *event) override; void focusInEvent(QFocusEvent *event) override; + void dragEnterEvent(QDragEnterEvent *event) override; + void dropEvent(QDropEvent *event) override; + private: void channelNameUpdated(const QString &newChannelName); void handleModifiers(Qt::KeyboardModifiers modifiers);