Coding Style Guidelines

The QT coding style is used with the following additions:

Member variables

Member variables (private and public) are prefixed by m.

Slots & Signals

Slots are prefixed by sl and signals sig

Implicit or explicit this pointers

Implicit this pointers are used when possible.

void A::f()
{
        this->mCount = 0; // wrong
        mCount = 0; // correct
}

Memory management

All memory management strategies directly supported by QT are accepted in addition to stack allocated objects ala. RAII.

For user-defined types smart pointers (as in QSharedPointer) is highly encouraged.

If statements and brackets

Contrary to the QT coding style, brackets are always used with if statements even if the body of the if statement only consist of a single line. This is to improve robustness.

Whitespace for pointers and references

// correct
int* value;
void* A::func(char* c) { ...

// wrong
int *value;
void *A::func(char *c) { ...