Code folding (#pragma region) in Qt creator

Horst Walter picture Horst Walter · Jul 2, 2012 · Viewed 11.5k times · Source

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

Answer

Sheridan picture Sheridan · Jul 11, 2014

I think you can do this:

Reformat your someclass.cpp

namespace ns
{
  CClass::CClass() {}
  CClass::~CClass() {}
  void CClass::Test() {}
  void CClass::Test2() {}
  void CClass::Test3() {}
}

for example as

namespace ns // construction-destruction
{
  CClass::CClass() {}
  CClass::~CClass() {}
}
namespace ns // test-region
{
  void CClass::Test() {}
  void CClass::Test2() {}
  void CClass::Test3() {}
}