Results 1 to 3 of 3

Thread: How to paste richtext with images to a QTextEdit

  1. #1
    Join Date
    May 2014
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default How to paste richtext with images to a QTextEdit

    If I paste content from a MS Word doc file( with say 3 images and some text) to a QTextEdit I don't see the images. So, how do I read the clipboard and convert the images to base64 before pasting to the QTextEdit so that I can save the document to a database.

  2. #2
    Join Date
    Jun 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to paste richtext with images to a QTextEdit

    Any answers to this question ??
    I have the same issue. I'm not even sure this is possible. Can an image embedded in a WordPad file be copy and pasted into QTextEdit ? (it also can't seem to go the other way). I have extended the QTextEdit class and can successfully copy and paste png or bmp files from Windows Explorer, which come through as Urls, but when an image is dragged over from Word Pad the formats include "Rich Text Format" and "Embedded Object". Is it even possible to paste these into Qt? My overridden insertFromMimeData, otherwise works pretty well. Is the solution to convert the rtf formatted data to html ? Is there any easy way to extract the embedded images ?
    Thanks

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,336
    Thanks
    36
    Thanked 1,528 Times in 1,479 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to paste richtext with images to a QTextEdit

    Quote Originally Posted by boatless View Post
    Is it even possible to paste these into Qt?
    QMimeData has no restrictions on what the data can be.
    The data might need some processing if it is not one of the things the class has convenience API for (images, URIs, text, HTML).

    Quote Originally Posted by boatless View Post
    Is the solution to convert the rtf formatted data to html ?
    That might be an option. Windows might even have some facility to convert RTF into HTML.

    Quote Originally Posted by boatless View Post
    Is there any easy way to extract the embedded images ?
    You'll probably need to search MSDN for that, it is not unlikely that Microsoft has tools/libraries for that.

    Cheers,
    _

Similar Threads

  1. Replies: 0
    Last Post: 14th November 2012, 10:24
  2. QTextEdit - disable paste()
    By PePeL in forum Qt Programming
    Replies: 3
    Last Post: 23rd December 2011, 07:51
  3. QTextEdit copy and paste into email.
    By chris_helloworld in forum Qt Programming
    Replies: 3
    Last Post: 16th November 2010, 08:17
  4. QTextEdit cut copy and paste signals.
    By chris_helloworld in forum Qt Programming
    Replies: 0
    Last Post: 19th October 2010, 11:15
  5. QTextEdit save as RichText width Images
    By kea_ in forum Qt Programming
    Replies: 2
    Last Post: 9th August 2010, 07:53

Tags for this Thread

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.