Results 1 to 3 of 3

Thread: QTextEdit + paste rich text as plain text only

  1. #1
    Join Date
    Feb 2008
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default QTextEdit + paste rich text as plain text only

    hello,

    when using QTextEdit the paste() inserts every format supported by the rich-text.

    How to make that when pasting it is inserted only plain text if available in clipboard ? or if there is rich-text in clipboard to convert it plain text and after that to paste it.

    thanks

  2. #2
    Join Date
    Feb 2008
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QTextEdit + paste rich text as plain text only

    the answer was quite easy, sorry for that.

    Qt Code:
    1. void QTextEdit::insertFromMimeData ( const QMimeData * source )
    2. {
    3. void QTextEdit::insertPlainText ( source->text() );
    4. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 6th February 2008 at 17:43. Reason: missing [code] tags

  3. #3
    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: QTextEdit + paste rich text as plain text only

    I guess you could have adjusted QTextEdit::acceptRichText as well.
    J-P Nurmi

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 10:49
  2. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 15:36
  3. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 13:05
  4. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 07:03

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.