Results 1 to 4 of 4

Thread: QTextEdit copy and paste into email.

  1. #1
    Join Date
    Feb 2010
    Posts
    52
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default QTextEdit copy and paste into email.

    Hi,
    I'm finding that when I copy text from a QTextEdit and paste into an email, (ms outlook), I'm loosing spaces and line feeds. I believe that this is becase the transfer is being done as html. (It works fine if the email format is plain text).

    Is there any way to tell the QTextEdit to only put plain text into the mimedata and not html on copy ? Annoyingly, the QTextEdit::copy function is not virtual so I can't simply override it and write my own.

    Chris.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QTextEdit copy and paste into email.

    Knowing Microsoft tools, they never ever paste text as normal text, it's almost always rich text.

    Outlook also might expect \r\n line endings.

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

    chris_helloworld (16th November 2010)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTextEdit copy and paste into email.

    Actually any slot when called as a slot acts as it was virtual so you can subclass QTextEdit, redeclare the copy slot and reimplement it. The only trick is that your implementation will only be called when copy() is called as a result of a signal and not a direct function call. But there is a much better option at your disposal - reimplement QTextEdit::createMimeDataFromSelection().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    chris_helloworld (16th November 2010)

  6. #4
    Join Date
    Feb 2010
    Posts
    52
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default Re: QTextEdit copy and paste into email.

    Thanks guys

Similar Threads

  1. QTextEdit cut copy and paste signals.
    By chris_helloworld in forum Qt Programming
    Replies: 0
    Last Post: 19th October 2010, 11:15
  2. copy/paste graphics from QTextEdit
    By jureko in forum Qt Programming
    Replies: 0
    Last Post: 10th June 2010, 08:58
  3. Replies: 0
    Last Post: 2nd May 2009, 20:09
  4. QTextEdit - copy and paste problems in X11
    By chezifresh in forum Qt Programming
    Replies: 2
    Last Post: 30th June 2008, 19:21
  5. using cut(), copy(), paste()
    By systemz89 in forum Newbie
    Replies: 5
    Last Post: 18th December 2007, 14:47

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.