QScriptEdit::QScriptEdit(QWidget *parent) : QPlainTextEdit(parent) { m_baseLineNumber = 1; m_executionLineNumber = -1; m_extraArea = new QScriptEditExtraArea(this); QObject::connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateExtraAreaWidth())); QObject::connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateExtraArea(QRect,int))); QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateExtraAreaWidth(); //> NeoScriptTools setTabStopWidth(24); #ifdef WIN32 QFont font("Courier New"); font.setPointSize(10); document()->setDefaultFont(font); #endif setLineWrapMode(QPlainTextEdit::NoWrap); //< NeoScriptTools #ifndef QT_NO_SYNTAXHIGHLIGHTER (void) new QScriptSyntaxHighlighter(document()); #endif }
void QScriptEdit::updateExtraArea(const QRect &rect, int dy) { if (dy) m_extraArea->scroll(0, dy); else m_extraArea->update(0, rect.y(), m_extraArea->width(), rect.height()); if (rect.contains(viewport()->rect())) updateExtraAreaWidth(); }
QScriptEdit::QScriptEdit(QWidget *parent) : QPlainTextEdit(parent) { m_baseLineNumber = 1; m_executionLineNumber = -1; m_extraArea = new QScriptEditExtraArea(this); QObject::connect(this, SIGNAL(blockCountChanged(int)),this, SLOT(updateExtraAreaWidth())); QObject::connect(this, SIGNAL(updateRequest(const QRect &,int)), this, SLOT(updateExtraArea(const QRect &,int))); QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine())); updateExtraAreaWidth(); #ifndef QT_NO_SYNTAXHIGHLIGHTER (void) new QScriptSyntaxHighlighter(document()); #endif }