Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Printing white spaces in QTextEdit
Forum Updated to NodeBB v4.3 + New Features

Printing white spaces in QTextEdit

Scheduled Pinned Locked Moved Solved General and Desktop
white spaces
2 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi, i want to see the White spaces. For example a Point for space, an arrow for tab and so on.

        QTextOption option;
        option.setFlags(QTextOption::ShowLineAndParagraphSeparators | QTextOption::ShowTabsAndSpaces);
        doc->setDefaultTextOption(option);
    

    This doesn't work, why?

    Please help me. Thanks

    Henrik

    1 Reply Last reply
    0
    • X Offline
      X Offline
      XavierLL
      wrote on last edited by XavierLL
      #2

      Hi Henrik,

      It should work ok, did you set the document into the QTextEdit using this method?

      QTextEdit::setDocument;

      This code worked for me:

          QTextEdit *te = new QTextEdit(this);
          QTextDocument* doc = new QTextDocument(this);
          te->setDocument(doc);
          te->insertPlainText("  test\n");
      
          QTextOption option;
          option.setFlags(QTextOption::ShowLineAndParagraphSeparators | QTextOption::ShowTabsAndSpaces);
          doc->setDefaultTextOption(option);
      
      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved