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

原文地址:https://www.cnblogs.com/lsgxeva/p/12505755.html

时间: 2024-08-03 15:19:15

QtCreator的一些自定义代码字体和颜色的相关文章

Android 自定义Spinner字体、颜色、大小

昨天在公司项目中遇到Spinner颜色,字体,大小的困惑.所以今天也总结一下这方面知识.这个其实很简单,要改变字体,颜色以及大小,无非就是不要用系统自带的样式.自已例外写一个layout调用就行了.我就是这样做的.本文例子还有Spinner两种弹出方式,下拉框以及弹出框.加载数据源的两种方式.下面看代码介绍. 本文项目源码地址:http://download.csdn.net/detail/qq_16064871/8583085 转载请注明出处: http://blog.csdn.net/qq_

自定义IPython Qt Console 窗口大小、字体、颜色

windows下将IPython Qt Console的快捷方式修改为: "C:\Python\IPython Qt Console.exe" --ConsoleWidget.font_family="Courier New" --ConsoleWidget.font_size=9 --ConsoleWidget.width=132 --ConsoleWidget.height=43 --colors=linux Linux下对应用以下方式启动: ipython q

Lable 控件 -- 用代码改变要显示字体的颜色

lable控件怎么改变显示字体的颜色 代码如下: 1 string color = "#B72C34"; 2 3 this.lbl.ForeColor = System.Drawing.ColorTranslator.FromHtml(color); *解说: 1. 字符串 color 是想要字体显示的颜色,在任意取色器中取色,复制粘贴过来即可. 2. lbl 为自己的lable控件所取的名称,可任意更改名称,但要跟前台界面中的 lable 控件的名称一致.

eclipse的设置代码字体大小、同变量或者方法被双击后显示颜色、每行显示代码字数

1.代码字体大小:菜单栏--window--preferences--general--appearance--color and fonts--basic--text font; 2.双击后显示明显的颜色:菜单栏--window--preferences--editors--text editors--annotations--occurrences,在右侧的"color"点击颜色栏换颜色: 3.每行显示代码字数:菜单栏--window--preferences,在搜索栏里搜索&qu

iOS6 导航条title字体和颜色-不适用自定义视图

一般的我们都是通过自定义视图来设置导航条的title颜色和字体的 UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 40)]; titleLabel.text = @"详情"; titleLabel.textColor = [UIColor whiteColor]; titleLabel.textAlignment = NSTextAlignmentCenter; self.naviga

Sublime Text3自定义全部字体大小、字体类型和背景颜色

一.定义侧栏的背景颜色.字体大小和间距 Sublime Text3的Afterglow主题链接为:https://github.com/YabataDesign/afterglow-theme 1.按键:ctrl+shift+p,弹出窗口中输入pro,选择图中的PackageResourceViewer:Open Resource. 2.在新窗口输入th,选中安装的主题,我个人安装的是Theme - Afterglow,就以Theme - Afterglow主题为例,其它主题类似. 3.在下拉列

在iOS7中修改状态栏字体的颜色-b

状态栏的字体为黑色: UIStatusBarStyleDefault 状态栏的字体为白色: UIStatusBarStyleLightContent 一.在 info.plist  中,将 View controller-based status bar appearance  设为 NO 状态栏字体的颜色只由下面的属性设定,默认为白色: // default is UIStatusBarStyleDefault [UIApplication sharedApplication].statusB

修改提示框字体及颜色

1.实例介绍 本文使用tooltip控件的draw事件重绘,修改提示框字体及颜色.创建一个winform项目,在一窗体上添加button控件和tooltip控件. 2.实现代码 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using Syst

Css3:选择器、字体和颜色样式

1.私有前缀及其用法 在CSS3模块标准尚未被W3C批准或者标准所提议的特性尚未被浏览器完全实现时,浏览器厂商会使用所谓的私有前缀来测试“试验性的”CSS特性.看看CSS3中实现圆角的代码: .round{ -khtml-border-radius:10px; /* Konqueror */ -rim-border-radius:10px; /* RIM */ -ms-border-radius:10px; /* Microsoft */ -o-border-radius:10px; /* Op