# class KTextEditor.Cursor

###

Table of contents
Modules
ktexteditor Classes
All Classes

Module | ktexteditor
Namespace | ktexteditor
Class | KTextEditor.Cursor
Inherits |

An object which represents a position in a Document.

A Cursor is a basic class which contains the line() and column() a position in a Document. It is very lightweight and maintains no affiliation with a particular Document.

If you want additional functionality such as the ability to maintain position in a document, see SmartCursor.

The Cursor class is designed to be passed via value, while SmartCursor and derivatives must be passed via pointer or reference as they maintain a connection with their document internally and cannot be copied.

Lines and columns start at 0.

Think of cursors as having their position at the start of a character, not in the middle of one.

If a Cursor is associated with a Range the Range will be notified whenever the cursor (i.e. start or end position) changes its position. Read the class documentation about Range%s for further details.

See also SmartCursor

### methods

- != (a0, a1)

  returns (bool)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- + (a0, a1)

  returns (KTextEditor.Cursor)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- += (a0, a1)

  returns (KTextEditor.Cursor)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- - (a0, a1)

  returns (KTextEditor.Cursor)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- -= (a0, a1)

  returns (KTextEditor.Cursor)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- < (a0, a1)

  returns (bool)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- << (a0, a1)

  returns (QDebug)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | QDebug |
  a1 | KTextEditor.Cursor |

- <= (a0, a1)

  returns (bool)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- == (a0, a1)

  returns (bool)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- > (a0, a1)

  returns (bool)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- >= (a0, a1)

  returns (bool)
  Method is not implemented

  Argument | Type | Default
  --- | --- | ---
  a0 | KTextEditor.Cursor |
  a1 | KTextEditor.Cursor |

- Cursor ()

  returns nothing

  The default constructor creates a cursor at position (0,0).

- Cursor (line, column)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  line | int |
  column | int |

  This constructor creates a cursor initialized with line and column.

  line - line for cursor

  column - column for cursor

- Cursor (copy)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  copy | KTextEditor.Cursor |

  Copy constructor. Does not copy the owning range, as a range does not have any association with copies of its cursors.

  copy - the cursor to copy.

- atStartOfDocument ()

  returns (bool)

  Determine if this cursor is located at the start of a document. Returns true if the cursor is situated at the start of the document, false if it isn't.

- atStartOfLine ()

  returns (bool)

  Determine if this cursor is located at the start of a line. Returns true if the cursor is situated at the start of the line, false if it isn't.

- column ()

  returns (int)

  Retrieve the column on which this cursor is situated. Returns column number, where 0 is the first column.

- cursorChangedDirectly (from)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  from | KTextEditor.Cursor |

  Internal

  Notify the owning range, if any, that this cursor has changed directly.

- invalid ()

  returns (KTextEditor.Cursor)
  static

  Returns an invalid cursor.

- isSmartCursor ()

  returns (bool)

  Returns whether this cursor is a SmartCursor.

- isValid ()

  returns (bool)

  Returns whether the current position of this cursor is a valid position (line + column must both be >= 0).

  Smart cursors should override this to return whether the cursor is valid within the linked document.

- line ()

  returns (int)

  Retrieve the line on which this cursor is situated. Returns line number, where 0 is the first line.

- position ()

  returns (), line (int), column (int)

- range ()

  returns (KTextEditor.Range)

  Returns the range that this cursor belongs to, if any.

- setColumn (column)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  column | int |

  Set the cursor column to column.

  column - new cursor column

- setLine (line)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  line | int |

  Set the cursor line to line.

  line - new cursor line

- setPosition (position)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  position | KTextEditor.Cursor |

  Position

  The following functions provide access to, and manipulation of, the cursor's position. \{ Set the current cursor position to position.

  position - new cursor position

  To do: add bool to indicate success or not, for smart cursors?

- setPosition (line, column)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  line | int |
  column | int |

  Set the cursor position to line and column.

  line - new cursor line

  column - new cursor column

- setRange (range)

  returns nothing

  Argument | Type | Default
  --- | --- | ---
  range | KTextEditor.Range |

  Internal

  Sets the range that this cursor belongs to.

  range - the range that this cursor is referenced from.

- start ()

  returns (KTextEditor.Cursor)
  static

  Returns a cursor representing the start of any document - i.e., line 0, column 0.

- toSmartCursor ()

  returns (KTextEditor.SmartCursor)

  Returns this cursor as a SmartCursor, if it is one.