Results 1 to 2 of 2

Thread: QTextBrowser paste insertFromMimeData(mimex)

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default 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?


    Qt Code:
    1. bool QVimedit::canInsertFromMimeData ( const QMimeData * source )
    2. {
    3. return QTextEdit::canInsertFromMimeData(source);
    4. qDebug() << "### insertFromMimeData 1 ";
    5. }
    6. void QVimedit::insertFromMimeData ( const QMimeData * source )
    7. {
    8.  
    9. qDebug() << "### insertFromMimeData 2 ";
    10.  
    11. if ( source->hasImage() ) {
    12. numerobase++;
    13. const QString nuovaim = QString("%2/image_%1.png").arg(numerobase).arg(QDir::homePath());
    14. QImage images = qvariant_cast<QImage>(source->imageData());
    15. bool salvato = images.save(nuovaim,"PNG",100);
    16. //////////////////qDebug() << "### salvato 1/0 " << salvato;
    17. emit TakeImage(nuovaim);
    18. return;
    19. }
    20. QTextEdit::insertFromMimeData(source);
    21. if ( source->formats().contains("text/html") ) {
    22. qDebug() << "### incomming paste text/html ";
    23. emit IncommingHTML();
    24. }
    25. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default 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().
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    patrik08 (18th March 2007)

Similar Threads

  1. QTextBrowser Problem
    By Cutey in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2007, 10:19
  2. QTextBrowser, how to scroll ?
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 22nd December 2006, 07:57
  3. CSS in QTextBrowser
    By gesslar in forum Qt Programming
    Replies: 1
    Last Post: 4th April 2006, 09:17
  4. [QT4] QtextBrowser and image size (win)
    By sebgui in forum Qt Programming
    Replies: 0
    Last Post: 28th March 2006, 21:01
  5. how to adjust sizes of QTextBrowser?
    By Pan Wojtas in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 22:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.