QTextBrowser paste insertFromMimeData(mimex)
I have reimplement QTextBrowser to paste image && load on a image tag <img> on QTextDocument
But i like to work on vector svg image format format how i can discovery this Mime?
&& save on disc format one copy as svg format & one as png?
Code:
bool QVimedit
::canInsertFromMimeData ( const QMimeData * source
) {
return QTextEdit::canInsertFromMimeData(source
);
qDebug() << "### insertFromMimeData 1 ";
}
void QVimedit
::insertFromMimeData ( const QMimeData * source
) {
qDebug() << "### insertFromMimeData 2 ";
if ( source->hasImage() ) {
numerobase++;
QImage images
= qvariant_cast<QImage>
(source
->imageData
());
bool salvato = images.save(nuovaim,"PNG",100);
//////////////////qDebug() << "### salvato 1/0 " << salvato;
emit TakeImage(nuovaim);
return;
}
if ( source->formats().contains("text/html") ) {
qDebug() << "### incomming paste text/html ";
emit IncommingHTML();
}
}
Re: QTextBrowser paste insertFromMimeData(mimex)
Maybe you could use the Drop Site Example to examine the mime format and contents? And about PNG, it should be possible with QSvgRenderer::render().