Skip to content

Commit 02251c3

Browse files
committed
Add italic and bold text style support.
1 parent 2a58a7c commit 02251c3

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

qlightterminal.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ void QLightTerminal::paintEvent(QPaintEvent *event) {
147147
return;
148148
}
149149

150+
QFont font;
150151
QString line;
151152
uint32_t fgColor = 0;
152153
uint32_t bgColor = 0;
@@ -219,6 +220,20 @@ void QLightTerminal::paintEvent(QPaintEvent *event) {
219220

220221
if (g.mode & ATTR_INVISIBLE)
221222
fgColor = bgColor;
223+
224+
font = painter.font();
225+
226+
if((g.mode & ATTR_BOLD) && !font.bold()) {
227+
font.setBold(true);
228+
} else if(!(g.mode & ATTR_BOLD) && font.bold()) {
229+
font.setBold(false);
230+
}
231+
232+
if((g.mode & ATTR_ITALIC) && !font.italic()) {
233+
font.setItalic(true);
234+
} else if(!(g.mode & ATTR_ITALIC) && font.italic()) {
235+
font.setItalic(false);
236+
}
222237
}
223238

224239
// draw current line state and change color
@@ -240,6 +255,7 @@ void QLightTerminal::paintEvent(QPaintEvent *event) {
240255

241256
line = QString();
242257
changed = false;
258+
painter.setFont(font);
243259
}
244260

245261
line += QChar(g.u);

0 commit comments

Comments
 (0)