Results 1 to 5 of 5

Thread: Problems with QTextEdit::cursorRect()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    369
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Problems with QTextEdit::cursorRect()

    I am playing with QTextEdit::cursorRect() and having problems. On large fonts, the rect returned to me is wrong, or I am just using this function badly. My code is basically:

    Qt Code:
    1. // p is a QPainter
    2. charWidth = p.fontMetrics().width( charStart );
    3. cursor.setPosition(matchStart, QTextCursor::MoveAnchor);
    4. r = cursorRect( cursor );
    5. p.fillRect( r.x()+charWidth, r.y(), charWidth, r.height(), matchBracesColor );
    To copy to clipboard, switch view to plain text mode 

    and this is not always working (see attached image). I am also attaching a small application which reproduces this problem (the app is tested under linux only, but should work on windows). Read the header of the file for compilation instructions. The code also contains a few font definitions which work or not.

    So... what am I missing here...?
    Attached Images Attached Images
    Attached Files Attached Files

Similar Threads

  1. Problems installing on MacOS X
    By a5char in forum Installation and Deployment
    Replies: 2
    Last Post: 26th March 2007, 21:45
  2. Replies: 2
    Last Post: 8th March 2007, 22:22
  3. Utf8 problems
    By cristiano in forum Qt Programming
    Replies: 5
    Last Post: 11th November 2006, 00:14
  4. Problems
    By euthymos in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2006, 19:11
  5. QT4 Plugins - problems, problems
    By NormanDunbar in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 15:39

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.