Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code folding (#pragma region) in Qt creator

Is there something similar to explicit code regions for folding in Qt Creator:

#pragma region Region_1
void Test() {}
void Test2() {}
void Test3() {}
#pragma endregion Region_1

I can see folding for logical code blocks, but do not know how to explicitly set such a block. My version of Qt Creator is 2.4.1

like image 888
Horst Walter Avatar asked Jul 02 '12 14:07

Horst Walter


2 Answers

Now we can do this by:

Right before the block that you want to fold you place the following define:

#define FOLDINGSTART {

and directly after the block you place:

#define FOLDINGEND }
like image 90
TerribleDog Avatar answered Sep 21 '22 18:09

TerribleDog


you can place your code in {} and write a comment for its name.

{ // RegionName 
    void Test() {}
    void Test2() {}
    void Test3() {}
}
like image 24
Kaveh Safavi Avatar answered Sep 20 '22 18:09

Kaveh Safavi