mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Dropping images now works on the whole split :)
This commit is contained in:
parent
d53bfbfdf2
commit
a929053c4b
4 changed files with 27 additions and 27 deletions
|
@ -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_;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <typename Iter, typename RandomGenerator>
|
||||
static Iter select_randomly(Iter start, Iter end, RandomGenerator &g)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue