Results 1 to 8 of 8

Thread: QTextEdit, QPlainTextEdit text padding - how?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2013
    Location
    Warsaw, Poland
    Posts
    10
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QTextEdit, QPlainTextEdit text padding - how?

    Hello. I have another question connected with my application - a Ms Notepad-ish thing. I use QPlainTextEdit to work with text files. Unlike QTextEdit, QPlainTextEdit seems to have this nice property of scrolling text line by line by default, so that no line is displayed cut in half. The only problem is, the first displayed line is uncomfortably close to QTextEdit's top edge. What I'd like to do is to set padding for the text inside the control, just like in Ms Notepad, but text only - I still want the scrollbar to fit snugly in its place, with no gaps.

    I tried using QPlainTextEdit::setContentsMargins(), QPlainTextEdit::setStyleSheet() with margins and padding, and some things that I even don't remember. I went through documentation of QPlainTextEdit, QTextEdit, and their ancestors, but didn't find anything that looked promising.

    Is there any way of doing this without reimplementing text edit?

    I attached my little app; everything's in mainwindow.cpp, if you care to have a look. Thanks.
    Attached Files Attached Files

Similar Threads

  1. Replies: 6
    Last Post: 1st October 2012, 14:05
  2. Selecting Text QPlainTextEdit
    By smhall316 in forum Newbie
    Replies: 0
    Last Post: 7th December 2010, 20:09
  3. margins in QTextEdit/QPlainTextEdit
    By corrado in forum Qt Programming
    Replies: 2
    Last Post: 22nd April 2010, 09:35
  4. Maximum input length for QTextEdit or QPlainTextEdit ??
    By b_ginner in forum Qt Programming
    Replies: 2
    Last Post: 22nd August 2009, 20:57
  5. QPlainTextEdit reload text
    By bunjee in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2009, 14:24

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.