Proposed fix (not perfect but way better than what you achieved previously) :
p.fillRect( r.x() + r.width() / 2, r.y(), charWidth, r.height(), matchBracesColor );
p.fillRect( r.x() + r.width() / 2, r.y(), charWidth, r.height(), matchBracesColor );
To copy to clipboard, switch view to plain text mode
It falls down to replacing charWidth by r.width() / 2. This is because :
- charWidth depends on the "matched" char while cursor is placed between characters bounds...
- cursor is in the middle of the rect returned by cursorRect
Bookmarks