[QScintilla] Width from Line nummer column

ciz at ciz.ch ciz at ciz.ch
Sat Jan 5 00:38:36 GMT 2008



> You could dynamically change the width of the line number margin by
> connecting to the linesChanged() signal. in the handler, make a string
> of the right length with QString().setNum(lines()) and pass the result
> to setMarginWidth().

1000 thanks...

i place a keyPressEvent on this way

void QsciScintilla::keyPressEvent(QKeyEvent *e)
{
    if (marginWidth(1) >= defaultFoldMarginWidth)
    setMarginWidth( 1 , qBound ( defaultFoldMarginWidth
,(int)(SendScintilla(SCI_GETZOOM) * 8.5) , 105 ));
    bool isResetZoom = ((e->modifiers() & Qt::ControlModifier) && e->key()
== Qt::Key_0); // CTRL+0
    if ( isResetZoom ) {
        zoomTo(0);
        setMarginWidth(1,defaultFoldMarginWidth);
        update();
        e->accept();
        return;
    }
    QsciScintillaBase::keyPressEvent(e);
}

MFG  Peter






More information about the QScintilla mailing list