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. How to get the coordinates(rows and columns) of the text cursor of QTextEdit?
QtWS25 Last Chance

How to get the coordinates(rows and columns) of the text cursor of QTextEdit?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 1.3k Views
  • 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.
  • I Offline
    I Offline
    Induwara.super
    wrote on last edited by
    #1

    I'm developing a simple notepad application with QT (windows 10, 64bit, mingw) and I want to display the coordinates of the text cursor in the status bar as shown below(in windows notepad).Untitled.png I'm a compete beginner in QT so sorry if you find out this question is stupid.

    jsulmJ 1 Reply Last reply
    0
    • I Induwara.super

      I'm developing a simple notepad application with QT (windows 10, 64bit, mingw) and I want to display the coordinates of the text cursor in the status bar as shown below(in windows notepad).Untitled.png I'm a compete beginner in QT so sorry if you find out this question is stupid.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Induwara-super But what is exactly your question?
      How to get coordinates?
      How to display them?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • I Offline
        I Offline
        Induwara.super
        wrote on last edited by
        #3

        The row and the column the cursor is currently in (ex: row-12, column -1) .
        I'm planning to use a label to display the, for example the ex thing somewhere in the window.

        jsulmJ 1 Reply Last reply
        0
        • I Induwara.super

          The row and the column the cursor is currently in (ex: row-12, column -1) .
          I'm planning to use a label to display the, for example the ex thing somewhere in the window.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Induwara-super https://doc.qt.io/qt-5/qtextedit.html#textCursor
          https://doc.qt.io/qt-5/qtextcursor.html#columnNumber
          Line number is more difficult - you will need to work with blocks: https://doc.qt.io/qt-5/qtextblock.html

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          I 1 Reply Last reply
          4
          • jsulmJ jsulm

            @Induwara-super https://doc.qt.io/qt-5/qtextedit.html#textCursor
            https://doc.qt.io/qt-5/qtextcursor.html#columnNumber
            Line number is more difficult - you will need to work with blocks: https://doc.qt.io/qt-5/qtextblock.html

            I Offline
            I Offline
            Induwara.super
            wrote on last edited by
            #5

            @jsulm Thank You So Much for helping me out with this problem.
            I struggled with this for hours Thank you again.

            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