overrides QTextEdit insert methods
fixes Chatterino#635 prepares for future implementation of Chatterino#79 Was a little bit hard to find the right combination for now. Pasting images from clipboard surpasses the check for dragging images in canInsertFromMimeData OMGScoots
This commit is contained in:
@@ -228,6 +228,27 @@ void ResizingTextEdit::insertCompletion(const QString &completion)
|
||||
this->setTextCursor(tc);
|
||||
}
|
||||
|
||||
bool ResizingTextEdit::canInsertFromMimeData(const QMimeData *source) const
|
||||
{
|
||||
if (source->hasImage())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (source->hasFormat("text/plain"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ResizingTextEdit::insertFromMimeData(const QMimeData *source)
|
||||
{
|
||||
if (!source->hasImage())
|
||||
{
|
||||
insertPlainText(source->text());
|
||||
}
|
||||
}
|
||||
|
||||
QCompleter *ResizingTextEdit::getCompleter() const
|
||||
{
|
||||
return this->completer_;
|
||||
|
||||
Reference in New Issue
Block a user