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. QTextBlockFormat setIndex(int indentation) bug ?
Qt 6.11 is out! See what's new in the release blog

QTextBlockFormat setIndex(int indentation) bug ?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k 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.
  • P Offline
    P Offline
    Pt_develop
    wrote on last edited by
    #1

    I'm trying to set the indent on a QTextBlock in QPlainTextEdit but the QTextBlockFormat method setIndex doesn't work. The code is

    @ QTextCursor indentCursor(currentBlock);
    QTextBlockFormat tbf=indentCursor.blockFormat();
    tbf.setIndent(indent);
    // tbf.setBackground(QBrush("Red")); // debug
    indentCursor.setBlockFormat(tbf);@

    The commented out line is simply to verify that the procedure works (it does, the blocks background turns a nice red). I've tried the procedure with various values of indent and have changed the document's default value from 40 to 400 in an effort to see if something works but nothing affects the text blocks indentation.

    Searching Google I found that this problem has been seen previously ("http://www.qtcentre.org/threads/33582-indent-selection-in-QPlainTextEdit":http://www.qtcentre.org/threads/33582-indent-selection-in-QPlainTextEdit) but no effective solution seems to have been found.

    Hopefully I'm just missing something obvious and would appreciate any comments or pointers that will help resolve this problem.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      QPlainTextEdit doesn't support as much text formatting as QTextEdit. You should ask this question on the interest mailing to know whether indentation should be.

      Currently, it's not (as in not implemented)

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

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