同步操作将从 陈炳煌/sqlitebrowser 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "docktextedit.h"#include "Settings.h"#include <Qsci/qscistyle.h>#include <Qsci/qscilexerjson.h>#include <Qsci/qscilexerxml.h>QsciLexerJSON* DockTextEdit::jsonLexer = nullptr;QsciLexerXML* DockTextEdit::xmlLexer = nullptr;DockTextEdit::DockTextEdit(QWidget* parent) :ExtendedScintilla(parent){// Create lexer objects if not done yetif(jsonLexer == nullptr)jsonLexer = new QsciLexerJSON(this);if(xmlLexer == nullptr)xmlLexer = new QsciLexerXML(this);// Set plain text as defaultsetLanguage(PlainText);jsonLexer->setFoldCompact(false);jsonLexer->setHighlightComments(true);// Do rest of initialisationreloadSettings();}DockTextEdit::~DockTextEdit(){}void DockTextEdit::reloadSettings(){// Set the parent settings for both lexersreloadLexerSettings(jsonLexer);reloadLexerSettings(xmlLexer);// Set the databrowser font for the plain text editor.plainTextFont = QFont(Settings::getValue("databrowser", "font").toString());plainTextFont.setPointSize(Settings::getValue("databrowser", "fontsize").toInt());setFont(plainTextFont);setupSyntaxHighlightingFormat(jsonLexer, "comment", QsciLexerJSON::CommentLine);setupSyntaxHighlightingFormat(jsonLexer, "comment", QsciLexerJSON::CommentBlock);setupSyntaxHighlightingFormat(jsonLexer, "keyword", QsciLexerJSON::Keyword);setupSyntaxHighlightingFormat(jsonLexer, "keyword", QsciLexerJSON::KeywordLD);setupSyntaxHighlightingFormat(jsonLexer, "function", QsciLexerJSON::Operator);setupSyntaxHighlightingFormat(jsonLexer, "string", QsciLexerJSON::String);setupSyntaxHighlightingFormat(jsonLexer, "table", QsciLexerJSON::Number);setupSyntaxHighlightingFormat(jsonLexer, "identifier", QsciLexerJSON::Property);// The default style for invalid JSON or unclosed strings uses red// background and white foreground, but the current line has// precedence, so it is by default white over gray. We change the// default to something more readable for the current line at// invalid JSON.QColor stringColor = QColor(Settings::getValue("syntaxhighlighter", "string_colour").toString());jsonLexer->setColor(stringColor, QsciLexerJSON::Error);jsonLexer->setColor(stringColor, QsciLexerJSON::UnclosedString);QFont errorFont(Settings::getValue("editor", "font").toString());errorFont.setPointSize(Settings::getValue("editor", "fontsize").toInt());errorFont.setItalic(true);jsonLexer->setFont(errorFont, QsciLexerJSON::Error);jsonLexer->setFont(errorFont, QsciLexerJSON::UnclosedString);jsonLexer->setPaper(jsonLexer->defaultPaper(QsciLexerJSON::String), QsciLexerJSON::Error);jsonLexer->setPaper(jsonLexer->defaultPaper(QsciLexerJSON::String), QsciLexerJSON::UnclosedString);xmlLexer->setColor(QColor(Settings::getValue("syntaxhighlighter", "foreground_colour").toString()));setupSyntaxHighlightingFormat(xmlLexer, "comment", QsciLexerHTML::HTMLComment);setupSyntaxHighlightingFormat(xmlLexer, "keyword", QsciLexerHTML::Tag);setupSyntaxHighlightingFormat(xmlLexer, "keyword", QsciLexerHTML::XMLTagEnd);setupSyntaxHighlightingFormat(xmlLexer, "keyword", QsciLexerHTML::XMLStart);setupSyntaxHighlightingFormat(xmlLexer, "keyword", QsciLexerHTML::XMLEnd);setupSyntaxHighlightingFormat(xmlLexer, "string", QsciLexerHTML::HTMLDoubleQuotedString);setupSyntaxHighlightingFormat(xmlLexer, "string", QsciLexerHTML::HTMLSingleQuotedString);setupSyntaxHighlightingFormat(xmlLexer, "table", QsciLexerHTML::HTMLNumber);setupSyntaxHighlightingFormat(xmlLexer, "identifier", QsciLexerHTML::Attribute);}void DockTextEdit::setLanguage(Language lang){m_language = lang;switch (lang) {case PlainText: {setLexer(nullptr);setFolding(QsciScintilla::NoFoldStyle);// This appears to be reset by setLexersetFont(plainTextFont);break;}case JSON:setLexer(jsonLexer);setFolding(QsciScintilla::BoxedTreeFoldStyle);break;case XML:setLexer(xmlLexer);setFolding(QsciScintilla::BoxedTreeFoldStyle);break;}}void DockTextEdit::setTextInMargin(const QString& text){clearMarginText();setMarginType(0, QsciScintilla::TextMargin);setMarginText(0, text, QsciStyle(QsciScintillaBase::STYLE_LINENUMBER));setMarginWidth(0, text);reloadCommonSettings();}void DockTextEdit::clearTextInMargin(){clearMarginText();setMarginLineNumbers(0, true);reloadCommonSettings();linesChanged();}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。