108 @param bg background color (QColor) |
108 @param bg background color (QColor) |
109 @param bold flag indicating bold text (boolean) |
109 @param bold flag indicating bold text (boolean) |
110 @return format definiton (QTextCharFormat) |
110 @return format definiton (QTextCharFormat) |
111 """ |
111 """ |
112 font = Preferences.getEditorOtherFonts("MonospacedFont") |
112 font = Preferences.getEditorOtherFonts("MonospacedFont") |
113 format = QTextCharFormat() |
113 charFormat = QTextCharFormat() |
114 format.setFontFamily(font.family()) |
114 charFormat.setFontFamily(font.family()) |
115 format.setFontPointSize(font.pointSize()) |
115 charFormat.setFontPointSize(font.pointSize()) |
116 |
116 |
117 if fg: |
117 if fg: |
118 format.setForeground(fg) |
118 charFormat.setForeground(fg) |
119 |
119 |
120 if bg: |
120 if bg: |
121 format.setBackground(bg) |
121 charFormat.setBackground(bg) |
122 |
122 |
123 if bold: |
123 if bold: |
124 format.setFontWeight(QFont.Bold) |
124 charFormat.setFontWeight(QFont.Bold) |
125 |
125 |
126 return format |
126 return charFormat |
127 |
127 |
128 def highlightBlock(self, text): |
128 def highlightBlock(self, text): |
129 """ |
129 """ |
130 Public method to highlight a block of text. |
130 Public method to highlight a block of text. |
131 |
131 |