Qt代碼配色VS2015風格


通過本文的方法可以將VS2015的深色主題界面應用到Qt上,對於喜歡VS代碼風格配色的人應該會比較有用

效果圖: 
這里寫圖片描述

1. 設置IDE主題

為了配合vs深色的代碼編輯背景,將Qt的主題也換成深色版本

這里寫圖片描述

2. 添加自定義代碼主題文件

將自定義的xml文件放在下圖中的目錄下

這里寫圖片描述

xml配色文件內容如下:

<?xml version="1.0" encoding="UTF-8"?>
<style-scheme version="1.0" name="VS2013(dark)">
  <style name="Text" foreground="#dcdcdc" background="#1e1e1e"/>
  <style name="Link" foreground="#4183c4"/>
  <style name="Selection" foreground="#ffffff" background="#3399ff"/>
  <style name="LineNumber" foreground="#2b91af" background="#1e1e1e"/>
  <style name="SearchResult" background="#555500"/>
  <style name="SearchScope" background="#1e1e1e"/>
  <style name="Parentheses" foreground="#ff5555" background="#333333"/>
  <style name="CurrentLine" background="#707070"/>
  <style name="CurrentLineNumber" foreground="#aaaaaa" bold="true"/>
  <style name="Occurrences" background="#363636"/>
  <style name="Occurrences.Unused" foreground="#3b84b1"/>
  <style name="Occurrences.Rename" foreground="#ffaaaa" background="#553636"/>
  <style name="Number" foreground="#b5ceba"/>
  <style name="String" foreground="#d69d85"/>
  <style name="PrimitiveType" foreground="#3b84b1"/>
  <style name="Type" foreground="#4ec9b0"/>
  <style name="Local"/>
  <style name="Field"/>
  <style name="Static" foreground="#f3f351" italic="true"/>
  <style name="VirtualMethod" italic="true"/>
  <style name="Function" foreground="#bebebe"/>
  <style name="Keyword" foreground="#569cd6"/>
  <style name="Operator" foreground="#aaaaaa"/>
  <style name="Preprocessor" foreground="#bd63c5"/>
  <style name="Label" foreground="#569cd6"/>
  <style name="Comment" foreground="#57a64a"/>
  <style name="Doxygen.Comment" foreground="#57a64a"/>
  <style name="Doxygen.Tag" foreground="#00a0a0"/>
  <style name="VisualWhitespace" foreground="#c0c0c0"/>
  <style name="QmlLocalId" italic="true"/>
  <style name="QmlExternalId" foreground="#aaaaff" italic="true"/>
  <style name="QmlTypeId" foreground="#f3f351"/>
  <style name="QmlRootObjectProperty" italic="true"/>
  <style name="QmlScopeObjectProperty" italic="true"/>
  <style name="QmlExternalObjectProperty" foreground="#aaaaff" italic="true"/>
  <style name="JsScopeVar" foreground="#8888ff" italic="true"/>
  <style name="JsImportVar" foreground="#8888ff" italic="true"/>
  <style name="JsGlobalVar" foreground="#8888ff" italic="true"/>
  <style name="QmlStateName" italic="true"/>
  <style name="Binding" foreground="#ff5555"/>
  <style name="DisabledCode" foreground="#777777" background="#222222"/>
  <style name="AddedLine" foreground="#55ffff"/>
  <style name="RemovedLine" foreground="#ff5555"/>
  <style name="DiffFile" foreground="#57a64a"/>
  <style name="DiffLocation" foreground="#ffff55"/>
  <style name="DiffFileLine" foreground="#000000" background="#d7d700"/>
  <style name="DiffContextLine" foreground="#000000" background="#8aaab6"/>
  <style name="DiffSourceLine" background="#8c2d2d"/>
  <style name="DiffSourceChar" foreground="#000000" background="#c34141"/>
  <style name="DiffDestLine" background="#2d8c2d"/>
  <style name="DiffDestChar" foreground="#000000" background="#41c341"/>
</style-scheme>

3. 設置代碼風格配色

添加完成文件后,重啟Qt Creator在下圖界面選擇主題之后就完成設置了

這里寫圖片描述

補充:

如果想要修改某一類別的顏色,可以直接去xml文件中修改16進制顏色,也可以在ide里面復制這個主題后,在ide內部修改顏色,后者更加方便一些。

本文鏈接:https://blog.csdn.net/Kou_Gyouu/article/details/78163213


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM