mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-24 16:51:25 -04:00
Enabled embedded images in private chat and messages (only for QT version 4.7.0 and higher)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6083 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a2a27a874f
commit
138a35b2a2
3 changed files with 24 additions and 24 deletions
|
@ -33,11 +33,11 @@ bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
|
|||
{
|
||||
#if QT_VERSION >= 0x040700
|
||||
// embedded images are not supported before QT 4.7.0
|
||||
// if (source != NULL) {
|
||||
// if (source->hasImage()) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
if (source != NULL) {
|
||||
if (source->hasImage()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return QTextEdit::canInsertFromMimeData(source);
|
||||
|
@ -47,20 +47,20 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
|
|||
{
|
||||
#if QT_VERSION >= 0x040700
|
||||
// embedded images are not supported before QT 4.7.0
|
||||
// if (source != NULL) {
|
||||
// if (source->hasImage()) {
|
||||
// // insert as embedded image
|
||||
// QImage image = qvariant_cast<QImage>(source->imageData());
|
||||
// if (image.isNull() == false) {
|
||||
// QString encodedImage;
|
||||
// if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480)) {
|
||||
// QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
|
||||
// this->textCursor().insertFragment(fragment);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (source != NULL) {
|
||||
if (source->hasImage()) {
|
||||
// insert as embedded image
|
||||
QImage image = qvariant_cast<QImage>(source->imageData());
|
||||
if (image.isNull() == false) {
|
||||
QString encodedImage;
|
||||
if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480)) {
|
||||
QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
|
||||
this->textCursor().insertFragment(fragment);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return QTextEdit::insertFromMimeData(source);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue