#40 cursorRect()

SVN
closed-invalid
QCodeEdit (16)
5
2009-01-05
2008-12-07
No

I have the impression (when i use in my application and by looking the code of qcodeedit) that cursorRect() and cursorRect(QDocumentCursor&), when no selection, return the position of the line but not of the cursor. So if the cursor is in the middle of line, cursorRect method return the start of the line.

Discussion

  • fullmetalcoder

    fullmetalcoder - 2008-12-08

    cursorRect() returns the lineRect() of the line the cursor when there is no selection or the union of lineRect() of all the lines on which the selection spans when there is a selection.

    This is the indented behavior because these functions are primary meant to be used internally to tell the Qt painting system which area needs to be updated.

    If you want more accurate positioning you have to use QDocumentCursor::documentPosition() which returns the position of the top of the cursor line in document (i.e viewport) coordinates. This line is one pix wide and QDocument::fontMetrics().lineSpacing() pix high.

     
  • fullmetalcoder

    fullmetalcoder - 2008-12-08
    • assigned_to: nobody --> fullmetalcoder
     
  • fullmetalcoder

    fullmetalcoder - 2008-12-08
    • status: open --> open-invalid
     
  • fullmetalcoder

    fullmetalcoder - 2009-01-05
    • status: open-invalid --> closed-invalid
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks