Skip to content
Permalink
Browse files
Fix monospace font use
  • Loading branch information
nyalldawson committed Apr 21, 2021
1 parent 1404a79 commit 028f66381bcc37356b340e09b9b88b2a2ab981b6
Showing with 5 additions and 2 deletions.
  1. +4 −2 src/gui/qgsrichtexteditor.cpp
  2. +1 −0 src/gui/qgsrichtexteditor.h
@@ -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 );
@@ -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;
@@ -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 );
}
@@ -168,6 +168,7 @@ class GUI_EXPORT QgsRichTextEditor : public QWidget, protected Ui::QgsRichTextEd
QgsColorButton *mBackColorButton = nullptr;

QPointer<QTextList> mLastBlockList;
QString mMonospaceFontFamily;
};


0 comments on commit 028f663

Please sign in to comment.