From b3fb9e223bb1b3432ea690218cffa50b3269250c Mon Sep 17 00:00:00 2001 From: "royqh1979@gmail.com" Date: Sun, 10 Oct 2021 21:46:11 +0800 Subject: [PATCH] - fix: editor's font style shouldn't affect gutter's font style --- NEWS.md | 1 + RedPandaIDE/colorscheme.cpp | 8 ++++---- RedPandaIDE/qsynedit/TextPainter.cpp | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index a8c9cbe9..a7be0098 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ Version 0.6.4 - fix: code completion popup not show after '->' inputted - fix: font styles in the color scheme settings not in effect + - fix: editor's font style shouldn't affect gutter's font style Version 0.6.3 - fix: should use c++ syntax to check ".h" files diff --git a/RedPandaIDE/colorscheme.cpp b/RedPandaIDE/colorscheme.cpp index 7098fc65..e0938085 100644 --- a/RedPandaIDE/colorscheme.cpp +++ b/RedPandaIDE/colorscheme.cpp @@ -200,19 +200,19 @@ PColorSchemeItem ColorSchemeItem::fromJson(const QJsonObject &json) item->setBold(false); } if (json.contains("italic") && json["italic"].isBool()) { - item->setBold(json["italic"].toBool()); + item->setItalic(json["italic"].toBool()); } else { item->setItalic(false); } if (json.contains("underlined") && json["underlined"].isBool()) { - item->setBold(json["underlined"].toBool()); + item->setUnderlined(json["underlined"].toBool()); } else { item->setUnderlined(false); } if (json.contains("strikeout") && json["strikeout"].isBool()) { - item->setBold(json["strikeout"].toBool()); + item->setStrikeout(json["strikeout"].toBool()); } else { - item->setUnderlined(false); + item->setStrikeout(false); } return item; } diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 919d29fa..a797bdf4 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -100,6 +100,13 @@ void SynEditTextPainter::paintGutter(const QRect& clip) if (edit->mGutter.useFontStyle()) { painter->setFont(edit->mGutter.font()); + } else { + QFont newFont = painter->font(); + newFont.setBold(false); + newFont.setItalic(false); + newFont.setStrikeOut(false); + newFont.setUnderline(false); + painter->setFont(newFont); } if (edit->mGutter.textColor().isValid()) { painter->setPen(edit->mGutter.textColor());