Results 1 to 2 of 2

Thread: Printing white spaces in QPlainTextEdit- the QtCreator way

  1. #1
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Printing white spaces in QPlainTextEdit- the QtCreator way

    Hi all, I am trying to understand what's the way to print white spaces inside a QPlainTextEdit (or QTextEdit...) and I am looking for advices - what's the best way to do this?

    Can anyone find how/where it's done in QtCreator?

  2. #2
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Printing white spaces in QPlainTextEdit- the QtCreator way

    Qt Code:
    1. QTextOption option = document()->defaultTextOption();
    2. if (on)
    3. option.setFlags(option.flags() | QTextOption::ShowTabsAndSpaces);
    4. else
    5. option.setFlags(option.flags() & ~QTextOption::ShowTabsAndSpaces);
    6. option.setFlags(option.flags() | QTextOption::AddSpaceForLineAndParagraphSeparators);
    7. document()->setDefaultTextOption(option);
    To copy to clipboard, switch view to plain text mode 

    It seems this functionality has been moved down to QTextDocument:
    http://qt.nokia.com/doc/4.6/qtextoption.html#Flag-enum

Similar Threads

  1. White background in window, getting desperate!
    By dictoon in forum Qt Programming
    Replies: 19
    Last Post: 31st December 2009, 08:35
  2. QTextBrowser & QPlainTextEdit swallow spaces?
    By gnreeke in forum Qt Programming
    Replies: 1
    Last Post: 16th December 2009, 19:08
  3. Printing plot black & white
    By maybe78 in forum Qwt
    Replies: 4
    Last Post: 9th October 2009, 07:39
  4. White Lines in graphicsview
    By nicolas1 in forum Qt Programming
    Replies: 6
    Last Post: 20th November 2008, 05:05
  5. Screen get white on minimize?
    By vishal.chauhan in forum Qt Programming
    Replies: 2
    Last Post: 11th August 2008, 21:22

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.