Results 1 to 3 of 3

Thread: QTextEdit line number under cursor

  1. #1
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTextEdit line number under cursor

    Hello All,

    I have checked many sites for getting line number from QTextEdit where cursor is present, but none of the answers is satisfactory.
    Simple ask is get line number if word supplied is present in QTextEdit and if not present then -1 to be returned.
    Also, I want to find last line number.


    Thanks

    Manish

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTextEdit line number under cursor

    Define "line number". If a line wraps is it one line or two? Can the user see a line number in their edit?

  3. #3
    Join Date
    Jun 2018
    Location
    Bangalore, India
    Posts
    6
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit line number under cursor

    Have you tried using QPlainTextEdit class. It has the Qtextcursor that might just solve your problem.

Similar Threads

  1. Replies: 0
    Last Post: 24th April 2014, 08:54
  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. Replies: 2
    Last Post: 20th February 2012, 21:58
  4. Line Number - QTextEdit...???
    By deepusrp in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16:34
  5. How to synchronize text cursor and cursor in QTextEdit
    By kennyxing in forum Qt Programming
    Replies: 6
    Last Post: 18th February 2007, 09:14

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.