/** * Recursively updates lexer style properties, using the data stored in the * model. * @param node The style node holding the lexer to update */ void LexerStyleModel::updateLexerStyle(const Node* node) const { StyleData* data = static_cast<StyleData*>(node->data()); QsciLexer* lexer = data->lexer_; int style = data->style_; // Update lexer properties. QFont font = propertyDataFromNode(node, Font)->value_.value<QFont>(); lexer->setFont(font, style); QColor foreground = propertyDataFromNode(node, Foreground)->value_.value<QColor>(); lexer->setColor(foreground, style); QColor background = propertyDataFromNode(node, Background)->value_.value<QColor>(); lexer->setPaper(background, style); // This is really nasty, but Scintilla leaves us no choice... // The EOL Fill flag needs to be set in order for whitespace past the end // of line to be drawn in the desired background colour. We apply this flag // to the default style, as well as any styles that have the same background // colour as the default. if ((style == lexer->defaultStyle()) || (lexer->paper(style) == lexer->paper(lexer->defaultStyle()))) { lexer->setEolFill(true, style); } // Recursive call. for (int i = 0; i < node->childCount(); i++) updateLexerStyle(node->child(i)); }