[Interest] Text editor's line numbers: misalignment

Diego Iastrubni diegoiast at gmail.com
Wed Aug 22 10:09:09 CEST 2012


On Wed, Aug 22, 2012 at 10:55 AM, Sensei <senseiwa at gmail.com> wrote:

> If I change the font to "Courier", or "Times", or "Andale Mono" or
> Xcode's "Menlo", everything is OK, I've tested alignment with 10K lines.
>
> When I use "Monaco", the font I intended to use, lines numbers get
> misaligned almost immediately.
>
>
> CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
> {
>    lineNumberArea = new LineNumberArea(this);
>
>    connect(this, SIGNAL(blockCountChanged(int)), this,
> SLOT(updateLineNumberAreaWidth(int)));
>    connect(this, SIGNAL(updateRequest(QRect,int)), this,
> SLOT(updateLineNumberArea(QRect,int)));
>    connect(this, SIGNAL(cursorPositionChanged()), this,
> SLOT(highlightCurrentLine()));
>
>    setFont(QFont("Courier", 22));
>
>    updateLineNumberAreaWidth(0);
>    highlightCurrentLine();
> }
>
>
>
1) use the same font for the line number as the text editor -

or

2) set the hight of each line in the panel, as the hight of each line in
the editor.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120822/eb669a64/attachment.html>


More information about the Interest mailing list