void Editor::doMatchingPar() { // Clear previous. setExtraSelections(QList<QTextEdit::ExtraSelection>()); if (!Settings::instance()->syntaxHighlighting) return; doMatchingLeft(); doMatchingRight(); }
Editor::Editor( QWidget* parent, const char* name ): QTextEdit( parent, name ) { d = new Private; d->eval = 0; d->index = 0; d->autoCompleteEnabled = true; d->completion = new EditorCompletion( this ); d->completionTimer = new QTimer( this ); d->autoCalcEnabled = true; d->syntaxHighlightEnabled = true; d->highlighter = new EditorHighlighter( this ); d->autoCalcTimer = new QTimer( this ); d->matchingTimer = new QTimer( this ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); setWordWrap( NoWrap ); setHScrollBarMode( AlwaysOff ); setVScrollBarMode( AlwaysOff ); setTextFormat( PlainText ); setAutoFormatting( AutoNone ); setTabChangesFocus( true ); setLinkUnderline( false ); connect( d->completion, SIGNAL( selectedCompletion( const QString& ) ), SLOT( autoComplete( const QString& ) ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkAutoComplete() ) ); connect( d->completionTimer, SIGNAL( timeout() ), SLOT( triggerAutoComplete() ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkMatching() ) ); connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingLeft() ) ); connect( d->matchingTimer, SIGNAL( timeout() ), SLOT( doMatchingRight() ) ); connect( this, SIGNAL( textChanged() ), SLOT( checkAutoCalc() ) ); connect( d->autoCalcTimer, SIGNAL( timeout() ), SLOT( autoCalc() ) ); d->autoCalcLabel = new CalcResultLabel( 0, "autocalc", WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM ); d->autoCalcLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); d->autoCalcLabel->setPalette( QToolTip::palette() ); d->autoCalcLabel->hide(); setHighlightColor( Number, QColor(0,0,127) ); setHighlightColor( FunctionName, QColor(85,0,0) ); setHighlightColor( Variable, QColor(0,85,0) ); setHighlightColor( MatchedPar, QColor(255,255,183) ); }