25 : QsciScintilla( parent )
26 , mWidgetTitle( title )
30 if ( !parent && mWidgetTitle.isEmpty() )
32 setWindowTitle(
"Text Editor" );
33 setMinimumSize( 800, 300 );
37 setWindowTitle( mWidgetTitle );
40 setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
47 void QgsCodeEditor::setSciWidget()
50 setCaretLineVisible(
true );
51 setCaretLineBackgroundColor( QColor(
"#fcf3ed" ) );
53 setBraceMatching( QsciScintilla::SloppyBraceMatch );
54 setMatchedBraceBackgroundColor( QColor(
"#b7f907" ) );
60 setAutoIndent(
true );
61 setIndentationWidth( 4 );
62 setTabIndents(
true );
63 setBackspaceUnindents(
true );
66 setAutoCompletionThreshold( 2 );
67 setAutoCompletionSource( QsciScintilla::AcsAPIs );
72 setWindowTitle( title );
80 QFont marginFont(
"Courier", 10 );
81 setMarginLineNumbers( 1,
true );
82 setMarginsFont( marginFont );
83 setMarginWidth( 1,
"00000" );
84 setMarginsForegroundColor( QColor(
"#3E3EE3" ) );
85 setMarginsBackgroundColor( QColor(
"#f9f9f9" ) );
89 setMarginWidth( 0, 0 );
90 setMarginWidth( 1, 0 );
91 setMarginWidth( 2, 0 );
100 setFolding( QsciScintilla::PlainFoldStyle );
101 setFoldMarginColors( QColor(
"#f4f4f4" ), QColor(
"#f4f4f4" ) );
105 setFolding( QsciScintilla::NoFoldStyle );
112 if ( hasSelectedText() )
114 replaceSelectedText( theText );
119 getCursorPosition( &line, &index );
120 insertAt( theText, line, index );
121 setCursorPosition( line, index + theText.length() );
128 const QFontInfo fi( font );
129 return fi.fixedPitch();
135 QString loadFont = settings.value(
"pythonConsole/fontfamilytextEditor",
"Monospace" ).toString();
136 int fontSize = settings.value(
"pythonConsole/fontsizeEditor", 10 ).toInt();
138 QFont font( loadFont );
139 font.setFixedPitch(
true );
140 font.setPointSize( fontSize );
141 font.setStyleHint( QFont::TypeWriter );
142 font.setStretch( QFont::SemiCondensed );
143 font.setLetterSpacing( QFont::PercentageSpacing, 87.0 );
144 font.setBold(
false );