Skip to content

Commit f6d6c69

Browse files
committedFeb 5, 2015
Use Python editor font and size for code editor
1 parent 9de6ae9 commit f6d6c69

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed
 

‎src/gui/qgscodeeditor.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -131,25 +131,16 @@ bool QgsCodeEditor::isFixedPitch( const QFont& font )
131131

132132
QFont QgsCodeEditor::getMonospaceFont()
133133
{
134-
QFont font( "monospace" );
135-
if ( isFixedPitch( font ) )
136-
{
137-
return font;
138-
}
139-
font.setStyleHint( QFont::Monospace );
140-
if ( isFixedPitch( font ) )
141-
{
142-
return font;
143-
}
134+
QSettings settings;
135+
QString loadFont = settings.value( "pythonConsole/fontfamilytextEditor", "Monospace" ).toString();
136+
int fontSize = settings.value( "pythonConsole/fontsizeEditor", 10 ).toInt();
137+
138+
QFont font( loadFont );
139+
font.setFixedPitch( true );
140+
font.setPointSize( fontSize );
144141
font.setStyleHint( QFont::TypeWriter );
145-
if ( isFixedPitch( font ) )
146-
{
147-
return font;
148-
}
149-
font.setFamily( "courier" );
150-
if ( isFixedPitch( font ) )
151-
{
152-
return font;
153-
}
142+
font.setStretch( QFont::SemiCondensed );
143+
font.setLetterSpacing( QFont::PercentageSpacing, 87.0 );
144+
font.setBold( false );
154145
return font;
155146
}

‎src/gui/qgscodeeditorpython.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ void QgsCodeEditorPython::setSciLexerPython()
5252
setWhitespaceVisibility( QsciScintilla::WsVisibleAfterIndent );
5353

5454
QFont font = getMonospaceFont();
55-
font.setPointSize( 10 );
5655

5756
QsciLexerPython* pyLexer = new QsciLexerPython();
5857
pyLexer->setDefaultFont( font );

0 commit comments

Comments
 (0)
Please sign in to comment.