Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there some ways to change settings of Qt Creator syntax highlighting?

Tags:

I'm using Qt Creator 4.6.2 based on Qt 5.11.1 in Ubuntu 18.10 to C++ programming with CONFIG += console c++17 key in .pro file and I got problem with following code:

std::for_each(attributes.begin(), attributes.end(), [&,i{0}](auto it) mutable {compressed.col_id[i] = it.first; i++;});

Qt Creator underlines this code in red and says "expected token ';' got '{'" but compiler runs this code without problems. Also when I tried to run this code:

int i = 0;
std::for_each(attributes.begin(), attributes.end(), [&](auto it) mutable {compressed.col_id[i] = it.first; i++;});

Qt Creator not underlined it.

I think it could be some problems with parsing in IDE so how I can deal with it?

like image 496
Alexander Slesarev Avatar asked Nov 25 '18 12:11

Alexander Slesarev


People also ask

How does syntax highlighting change the program?

Syntax Highlighting means using colors and fonts to help distinguish language elements in programming languages and other types of structured files. Programmers use syntax highlighting to understand code faster and better, and to spot many kinds of syntax errors more quickly.

How do I change the theme on my Qt Creator?

To switch themes, select Edit > Preferences > Environment, and then select a theme in the Theme field. You can use the Qt Creator text and code editors with your favorite color scheme that defines how code elements are highlighted and which background color is used.

What is syntax highlighting style?

Syntax highlighting is a feature of text editors that are used for programming, scripting, or markup languages, such as HTML. The feature displays text, especially source code, in different colours and fonts according to the category of terms.

What is the latest version of Qt Creator?

The latest version of Qt is 6.3. 1 released on 14 June 2022.


1 Answers

Try to use the ClangCodeModel for C++. It might be experimental in your version but I´ve used it there as well. Might be slow though.

Clang Code Model

like image 53
yussuf Avatar answered Nov 15 '22 07:11

yussuf