Results 1 to 13 of 13

Thread: QTextEdit - margins, indents within QTextEdit

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2013
    Posts
    13
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    6

    Default QTextEdit - margins, indents within QTextEdit

    I want to have possibility of changing margins/indents in QTextEdit, without resizing QTextEdit.

    What I mean is that when I use stylesheets:
    Qt Code:
    1. textEdit->setStyleSheet("QTextEdit{margin-left: 30px; (...)}");
    To copy to clipboard, switch view to plain text mode 
    the result looks like this:
    1.png
    QTextEdit is resized, and scroll bar is moved with it.

    I would like to achieve something like this:
    2.png
    Margins/indents are within QTextEdit and scrollbar is on the right just by window frame.

    I tried with:
    Qt Code:
    1. textEdit->setStyleSheet("QTextEdit{text-indent: 60px}");
    To copy to clipboard, switch view to plain text mode 
    but that doesn't work.

    I also tried with QTextBlockFormat:
    Qt Code:
    1. textCursor = new QTextCursor(textEdit->textCursor());
    2. textBlockFormat = textCursor->blockFormat();
    3. textBlockFormat.setTopMargin(50);
    4. textBlockFormat.setLeftMargin(50);
    To copy to clipboard, switch view to plain text mode 
    but that also doesn't work.

    Anyone can guide me how to achieve this?
    Last edited by Acamapichtli; 5th April 2014 at 22:45.

Similar Threads

  1. QToolButton margins
    By bjoernbg in forum Qt Programming
    Replies: 4
    Last Post: 19th December 2024, 04:43
  2. Axis margins
    By jcox23 in forum Qwt
    Replies: 1
    Last Post: 10th December 2010, 10:55
  3. Replies: 1
    Last Post: 10th June 2010, 06:35
  4. margins in QTextEdit/QPlainTextEdit
    By corrado in forum Qt Programming
    Replies: 2
    Last Post: 22nd April 2010, 10:35
  5. margins in QSimpleRichText
    By Pan Wojtas in forum Qt Programming
    Replies: 3
    Last Post: 10th February 2006, 17:34

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
  •  
Qt is a trademark of The Qt Company.