[Qtcreator] Black topic similar to vs2013

Source: Internet
Author: User
Overview
Let's take a look at the final code color and interface color similar to vs2013's dark themes. Is it a bit exciting? If you only want to use it, you can skip to here. If you want to know how to configure it, continue.

Installation and Use
(1) configure the color scheme of the code editing area
Download the configuration price vs2013_dark.xml and copy it to the "qtcreator \ share \ qtcreator \ styles" directory under the qtcreator installation directory. Start qtcreator and open "Tools"-> "options". In the "Text Editor" Page, select the "vs2013_dark" color scheme from the "Color Scheme" drop-down box, click "application" to activate the Service. The Service will continue to take effect next time.
: Https://github.com/QingFengLangYue/qtcreator-style
Set the program:

(2) set the color subject of other areas to black.
This step is optional. The editing area of the Code after step (1) is already in the dark topic style of vs2013, but other areas (such as the project list and program output panel) it is displayed as a white background with a large contrast. It looks more comfortable to turn it into black. The method is to copy the following file dark.css to the "qtcreator \ bin" directory where the qtcreator program is located, and then start qtcreator on the command line. The format is as follows:
> [path to qtcreator] -stylesheet [path to dark.css]    
If it is in the qtcreator program directory, enter:
> qtcreator -stylesheet dark.css
: Https://github.com/QingFengLangYue/qtcreator-style
You can see that the program is started and the effect you have seen is displayed. Every time you start qtcreator from the command line and add program startup parameters, this is undoubtedly very painful. The following describes two methods to relieve pain:
Create shortcuts (Windows only)
For convenience, you can create a shortcut for the program on the window and add a startup parameter so that you do not need to input parameters on the command line every time. Right-click the attributes in the shortcut of qtcreator and enter the parameters in the target column. In this way, you can start qtcreator In the shortcut next time to obtain the dark theme Effect of vs2013.


Modify the Registry (Windows only)
Modify the registry and add parameters for opening *. Pro files. In this way, each time you double-click to open *. Pro files, a dark topic similar to vs2013 will be used, which is more convenient than creating shortcuts. Open "hkey_classes_root \ qtproject. qtcreator. PRO \ shell \ open \ command" and change its content
[path to qtcreator.exe] -client "%1" -stylesheet [path to dark.css]
In this way, when you use qtcreator to open the *. Pro file, the custom style will be used. The following configurations are available on my computer:
D:\Qt\Qt5.3.1\\Tools\QtCreator\bin\qtcreator.exe -client "%1" -stylesheet D:\Qt\Qt5.3.1\\Tools\QtCreator\bin\dark.css

Custom vs2013 dark color scheme
You can see in the "Tools"-> "options"-> "Text Editor" of qtcreator that some "Color Scheme" (color scheme) have been predefined in qtcreator) for our choice (vs2013 is configured by myself, and qtcreator itself is not preset. This is what we will talk about-how to configure your own color scheme ), my favorite is Vim (dark.

However, I do not like some syntax colors and brightness of VIM (dark). The dark theme style in vs2013 looks quite comfortable, so I decided to configure a vs2013 (dark) color scheme, the procedure is simple:
(1) Click "copy" on the right of the "Color Scheme" drop-down box and enter the custom color scheme name in the pop-up dialog box.

(2) edit the foreground color and background color of each element in the color scheme. All the editing results will be saved to the color topic you just created.

(3) After the topic is edited, click OK to take effect immediately.
How to share the color scheme with friends
Good things cannot be hidden. You need to share your mind! However, qtcreator does not provide the options for exporting the color scheme, but it does not matter. Since the topic has an effect each time it starts qtcreator, it must be saved in the local configuration file. Go to the installation directory of qtcreator and find the subdirectory of qtcreator: "XX \ qtcreator \ share \ qtcreator \ styles ". We found that the built-in color scheme of qtcreator is hidden here: here should be the default folder where qtcreator loads the color scheme, and our own color scheme file should also be placed here. But how can I not see my own theme style? In this case, Windows users should first think of the Application Data Directory ("% appdata % \ qtproject \ qtcreator \ styles"), where each user's application data is stored, the custom topic Style File vs2013 (dark) is found here ). XML, so I can find it! Put it in the styles directory under the qtcreator installation directory and load it correctly.
You only need to send the custom color scheme file to your friends and put it in the "XX \ qtcreator \ share \ qtcreator \ styles" directory under the qtcreator installation directory.
Improvement of deficiencies
Although the color of the code editing area has become as expected, other areas of qtcreator (such as the Project tree and output panel) still maintain the original white background style, which is not very harmonious. However, there is no solution. Since qtcreator is written in QT, stylesheet styles are also supported. Therefore, we can customize the control style of the qtcreator program, then modify the program startup parameters so that they can load custom styles at startup. In this way, you can change the display effect without modifying the source code of qtcreator.
With the feature that qapplication automatically supports stylesheet, you can add styles for Qt applications. The following is an excerpt from the description document of the qapplication constructor:
Qapplication: qapplication (Int & argc, char ** argv)
...
All QT programs automatically support the following command line options:

-Stylesheet = stylesheet, Sets the application stylesheet. The value must be a path to a file that contains the style sheet. -Stylesheet, Is the same as listed abve ....
Now we know how to modify the qtcreator program, but how to write style files is a problem, style syntax is similar to CSS (you can search for the "QT style sheet" Style File in QT help.
References
[1] stack overflowhttp: // stackoverflow.com/questions/2244774/qt-creator-color-scheme
[2] reference style 1 https://github.com/victorhaggqvist/qtcreator-style
[3] reference style 2 https://github.com/borzh/qt-creator-css/blob/master/qt-creator.css
[4] Put the style file in my article on GitHub, you can download the https://github.com/QingFengLangYue/qtcreator-style from the link below

[Qtcreator] Black topic similar to vs2013

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.