Set the proper size limits

This commit is contained in:
hunbernd 2017-10-23 17:04:20 +02:00
parent f434e6559b
commit 64481de74b
8 changed files with 54 additions and 36 deletions

View file

@ -69,7 +69,7 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
QImage image = qvariant_cast<QImage>(source->imageData());
if (image.isNull() == false) {
QString encodedImage;
if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480)) {
if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480, mMaxBytes)) {
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
textCursor().insertFragment(fragment);
return;

View file

@ -50,6 +50,8 @@ public:
QColor textColorQuote() const { return highliter->textColorQuote();}
bool onlyPlainText() const {return mOnlyPlainText;}
void setMaxBytes(int limit) {mMaxBytes = limit;}
public slots:
void setTextColorQuote(QColor textColorQuote) { highliter->setTextColorQuote(textColorQuote);}
void setOnlyPlainText(bool bOnlyPlainText) {mOnlyPlainText = bOnlyPlainText;}
@ -83,6 +85,7 @@ private:
QList<QAction*> mContextMenuActions;
RsSyntaxHighlighter *highliter;
bool mOnlyPlainText;
int mMaxBytes = -1; //limit content size, for pasting images
};
#endif // MIMETEXTEDIT_H