Skip to content

Commit

Permalink
Fix monospace font use
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 21, 2021
1 parent 1404a79 commit 028f663
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gui/qgsrichtexteditor.cpp
Expand Up @@ -57,6 +57,8 @@ QgsRichTextEditor::QgsRichTextEditor( QWidget *parent )
{
setupUi( this );

mMonospaceFontFamily = QgsCodeEditor::getMonospaceFont().family();

mToolBar->setIconSize( QgsGuiUtils::iconSize( false ) );

connect( mTextEdit, &QTextEdit::currentCharFormatChanged, this, &QgsRichTextEditor::slotCurrentCharFormatChanged );
Expand Down Expand Up @@ -394,7 +396,7 @@ void QgsRichTextEditor::textStyle( int )
case QgsRichTextEditor::ParagraphMonospace:
{
format = cursor.charFormat();
format.setFontFamily( QgsCodeEditor::getMonospaceFont().family() );
format.setFontFamily( mMonospaceFontFamily );
format.setFontStyleHint( QFont::Monospace );
format.setFontFixedPitch( true );
break;
Expand Down Expand Up @@ -543,7 +545,7 @@ void QgsRichTextEditor::fontChanged( const QFont &f )
}
else
{
if ( f.fixedPitch() && f.family() == QLatin1String( "Monospace" ) )
if ( f.fixedPitch() && f.family() == mMonospaceFontFamily )
{
mParagraphStyleCombo->setCurrentIndex( ParagraphMonospace );
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsrichtexteditor.h
Expand Up @@ -168,6 +168,7 @@ class GUI_EXPORT QgsRichTextEditor : public QWidget, protected Ui::QgsRichTextEd
QgsColorButton *mBackColorButton = nullptr;

QPointer<QTextList> mLastBlockList;
QString mMonospaceFontFamily;
};


Expand Down

0 comments on commit 028f663

Please sign in to comment.