QtCreator的一些自定义代码字体和颜色
QtCreator的一些自定义代码字体和颜色
一、配色方案:
配置方法:工具->选项->文本编辑器->配色方案
如果对这些QtCreator自带的配色方案不满意,则需要手动进行添加
方法:这些配色方案是以xml文件的形式存在于 %QtCreatorDir%\share\qtcreator\styles\ 中。
<?xml version="1.0" encoding="UTF-8"?> <style-scheme version="1.0" name="Qt Creator Dark"> <style name="Text" foreground="#d6cf9a" background="#2e2f30"/> <style name="Link" foreground="#d6c540"/> <style name="Selection" foreground="#bec0c2" background="#1d545c"/> <style name="LineNumber" foreground="#bec0c2" background="#404244"/> <style name="SearchResult" background="#8a7f2c"/> <style name="SearchScope" background="#8a602c"/> <style name="Parentheses" foreground="#bec0c2" background="#1d545c"/> <style name="ParenthesesMismatch" background="#ff6aad"/> <style name="AutoComplete" foreground="#2c408a" background="#9aa7d6"/> <style name="CurrentLine" background="#373737"/> <style name="CurrentLineNumber" foreground="#d6c540" bold="true"/> <style name="Occurrences" background="#8a402c"/> <style name="Occurrences.Unused" foreground="#8a7f2c"/> <style name="Occurrences.Rename" foreground="#ffaaaa" background="#553636"/> <style name="Number" foreground="#8a602c"/> <style name="String" foreground="#d69545"/> <style name="Type" foreground="#ff8080"/> <style name="Local" foreground="#d6bb9a"/> <style name="Global" foreground="#9aa7d6"/> <style name="Field"/> <style name="Static" foreground="#66a334" italic="true"/> <style name="VirtualMethod" italic="true"/> <style name="Function"/> <style name="Keyword" foreground="#45c6d6" italic="true"/> <style name="PrimitiveType" foreground="#d69aa7"/> <style name="Punctuation"/> <style name="Operator" foreground="#d6bb9a"/> <style name="Overloaded Operator"/> <style name="Preprocessor" foreground="#ff6aad"/> <style name="Label" foreground="#d6c540"/> <style name="Comment" foreground="#a8abb0" italic="true"/> <style name="Doxygen.Comment" foreground="#65676a" bold="true" italic="true"/> <style name="Doxygen.Tag" foreground="#66a334"/> <style name="VisualWhitespace" foreground="#bec0c2"/> <style name="QmlLocalId" foreground="#9acfd6" italic="true"/> <style name="QmlExternalId" foreground="#9aa7d6" italic="true"/> <style name="QmlTypeId" foreground="#66a334"/> <style name="QmlRootObjectProperty" italic="true"/> <style name="QmlScopeObjectProperty" italic="true"/> <style name="QmlExternalObjectProperty" foreground="#9aa7d6" italic="true"/> <style name="JsScopeVar" foreground="#9acfd6" italic="true"/> <style name="JsImportVar" foreground="#4564d6" italic="true"/> <style name="JsGlobalVar" foreground="#4564d6" italic="true"/> <style name="QmlStateName" foreground="#45c6d6" italic="true"/> <style name="Binding" foreground="#ff6aad"/> <style name="DisabledCode" foreground="#969696" background="#474747"/> <style name="AddedLine" foreground="#45c6d6"/> <style name="RemovedLine" foreground="#d65645"/> <style name="DiffFile" foreground="#66a334"/> <style name="DiffLocation" foreground="#d6c540"/> <style name="DiffFileLine" foreground="#2e2f30" background="#d6c540"/> <style name="DiffContextLine" foreground="#2e2f30" background="#65676a"/> <style name="DiffSourceLine" background="#8a2c40"/> <style name="DiffSourceChar" foreground="#2e2f30" background="#c34141"/> <style name="DiffDestLine" background="#588a2c"/> <style name="DiffDestChar" foreground="#2e2f30" background="#7cc33e"/> <style name="LogChangeLine" foreground="#d65645"/> <style name="Warning" underlineColor="#d6c545" underlineStyle="SingleUnderline"/> <style name="WarningContext" underlineColor="#d6c545" underlineStyle="DotLine"/> <style name="Error" underlineColor="#d65645" underlineStyle="SingleUnderline"/> <style name="ErrorContext" underlineColor="#d65645" underlineStyle="DotLine"/> <style name="Declaration" bold="true"/> <style name="OutputArgument" italic="true"/> </style-scheme>
二、代码区外的颜色
参考自此处 http://stackoverflow.com/questions/2244774/qt-creator-color-scheme
上述颜色方案的配置仅影响代码编辑区域,若要对其余区域进行自定义,需要用到Qt中的 CSS: QSS
将样式内容保存为css文件运行如下命令命令:
"E:\Qt\Qt5.12.7\Tools\QtCreator\bin\qtcreator.exe" --platform windows:dpiawareness=0 --stylesheet "E:\Qt\Qt5.12.7\Tools\QtCreator\bin\custom-style.css"
QWidget { font: 12pt "Microsoft YaHei"; } QPlainTextEdit { font: 12pt "Microsoft YaHei"; } QTreeView, QTextEdit, QListView, QLineEdit, QLabel, QToolTip, QMenu { font: "Microsoft YaHei"; }
启动脚本 start.bat
@echo off start "E:\Qt\Qt5.12.7\Tools\QtCreator\bin\qtcreator.exe" --platform windows:dpiawareness=0 --stylesheet "E:\Qt\Qt5.12.7\Tools\QtCreator\bin\custom-style.css" netsh wlan start hostednetwork taskkill /f /im cmd.exe exit
================ End
分类:
QT
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
2018-03-16 windows通过NSF挂载centos目录
2018-03-16 Markdown语法图解