Results 1 to 3 of 3

Thread: Code editor display the line number in an area to the right

  1. #1
    Join Date
    Jan 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Code editor display the line number in an area to the right

    I am just learning Qt. I want to show line number of QPlainTextEdit. I found this link http://doc.qt.io/qt-5/qtwidgets-widg...r-example.html
    and it worked. But now I want the editor displays the line numbers in an area to the RIGHTof the area for editing. I have been search google very much but i can't solve. How to solve? Thank you very much
    [1]: http://i.stack.imgur.com/x4AKi.png

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Code editor display the line number in an area to the right

    Hi, you can use the example and move the line number area to the right side. You just have to move some parameters in functions that define the position and size of the line number widget, e.g. CodeEditor::updateLineNumberAreaWidth()

    Best regards,

    Ginsengelf

  3. #3
    Join Date
    Jan 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Code editor display the line number in an area to the right

    Thank for your reply.
    I changed
    CodeEditor::updateLineNumberAreaWidth(){
    setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
    }
    but I cant't solve. I don't know which parameters have to move. Thank!

Similar Threads

  1. Replies: 7
    Last Post: 30th November 2013, 14:27
  2. How do I set a QTextEdit to a specific line by line number?
    By Coolname007 in forum Qt Programming
    Replies: 8
    Last Post: 1st February 2013, 05:18
  3. Qt line number in text editor
    By Nyx in forum Qt Programming
    Replies: 6
    Last Post: 24th August 2010, 10:16
  4. How to get Line Number in QWebView
    By nish in forum Qt Programming
    Replies: 0
    Last Post: 16th December 2009, 13:02
  5. Line Number - QTextEdit...???
    By deepusrp in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16: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.