mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
fix formating
This commit is contained in:
parent
f1e6f74c7d
commit
6f86e8ec5e
@ -25,11 +25,13 @@ for more details. Some additional detail see below.
|
|||||||
* Any header should have [include guard](https://en.wikipedia.org/wiki/Include_guard)
|
* Any header should have [include guard](https://en.wikipedia.org/wiki/Include_guard)
|
||||||
named as `CLASSNAMECAPS_H`
|
named as `CLASSNAMECAPS_H`
|
||||||
* If any `#if` directive is used condition should be mentioned in `#endif`:
|
* If any `#if` directive is used condition should be mentioned in `#endif`:
|
||||||
|
|
||||||
```
|
```
|
||||||
#if (FOO)
|
#if (FOO)
|
||||||
someCodeInside();
|
someCodeInside();
|
||||||
#endif /* FOO */
|
#endif /* FOO */
|
||||||
```
|
```
|
||||||
|
|
||||||
* `Q_PROPERTY` macro is allowed and recommended for QObject based classes.
|
* `Q_PROPERTY` macro is allowed and recommended for QObject based classes.
|
||||||
* Qt macros (e.g. `signals`, `slots`, `Q_OBJECT`, etc) are allowed.
|
* Qt macros (e.g. `signals`, `slots`, `Q_OBJECT`, etc) are allowed.
|
||||||
* Current project standard is **C++11**.
|
* Current project standard is **C++11**.
|
||||||
@ -40,11 +42,13 @@ for more details. Some additional detail see below.
|
|||||||
of `reinterpret_cast` is not recommended. It is highly recommended to use
|
of `reinterpret_cast` is not recommended. It is highly recommended to use
|
||||||
`dynamic_Cast` with the exception catching. It is also possible to use
|
`dynamic_Cast` with the exception catching. It is also possible to use
|
||||||
`qvariant_cast` if required. Exception is class constructors, e.g.:
|
`qvariant_cast` if required. Exception is class constructors, e.g.:
|
||||||
|
|
||||||
```
|
```
|
||||||
char c = 'c';
|
char c = 'c';
|
||||||
std::string s = "string";
|
std::string s = "string";
|
||||||
qDebug() << QString("some string") << QChar(c) << QString(s);
|
qDebug() << QString("some string") << QChar(c) << QString(s);
|
||||||
```
|
```
|
||||||
|
|
||||||
* C-like `NULL`, use `nullptr` instead.
|
* C-like `NULL`, use `nullptr` instead.
|
||||||
* It is highly recommended to avoid implicit casts.
|
* It is highly recommended to avoid implicit casts.
|
||||||
* Abstract classes (which has at least one pure virtual method) are allowed.
|
* Abstract classes (which has at least one pure virtual method) are allowed.
|
||||||
@ -103,11 +107,13 @@ Development
|
|||||||
* For experimental features development new branch `feature-foo` creation is allowed
|
* For experimental features development new branch `feature-foo` creation is allowed
|
||||||
and recommended.
|
and recommended.
|
||||||
* Experimental features should be added inside `BUILD_FUTURE` definition:
|
* Experimental features should be added inside `BUILD_FUTURE` definition:
|
||||||
|
|
||||||
```
|
```
|
||||||
#ifdef BUILD_FUTURE
|
#ifdef BUILD_FUTURE
|
||||||
someTestFunctionInside();
|
someTestFunctionInside();
|
||||||
#endif /* BUILD_FUTURE */
|
#endif /* BUILD_FUTURE */
|
||||||
```
|
```
|
||||||
|
|
||||||
* Any project specific build variable should be mentioned inside `version.h` as
|
* Any project specific build variable should be mentioned inside `version.h` as
|
||||||
well.
|
well.
|
||||||
|
|
||||||
@ -152,8 +158,9 @@ Tools
|
|||||||
|
|
||||||
* For QString concatenation use `QString::arg` method.
|
* For QString concatenation use `QString::arg` method.
|
||||||
* Any source file should have license header:
|
* Any source file should have license header:
|
||||||
|
|
||||||
```
|
```
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* This file is part of awesome-widgets *
|
* This file is part of awesome-widgets *
|
||||||
* *
|
* *
|
||||||
* awesome-widgets is free software: you can redistribute it and/or *
|
* awesome-widgets is free software: you can redistribute it and/or *
|
||||||
@ -170,20 +177,24 @@ Tools
|
|||||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
```
|
```
|
||||||
|
|
||||||
* Recommended class constructor for QObject based classes:
|
* Recommended class constructor for QObject based classes:
|
||||||
|
|
||||||
```
|
```
|
||||||
FooClass::FooClass(QObject *parent, const QVariant var)
|
FooClass::FooClass(QObject *parent, const QVariant var)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_var(var)
|
m_var(var)
|
||||||
{
|
{
|
||||||
qCDebug(LOG_AW);
|
qCDebug(LOG_AW);
|
||||||
// some code below if any
|
// some code below if any
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
* Property usage:
|
* Property usage:
|
||||||
|
|
||||||
```
|
```
|
||||||
Q_PROPERTY(bool prop READ prop WRITE setProp);
|
Q_PROPERTY(bool prop READ prop WRITE setProp);
|
||||||
public:
|
public:
|
||||||
bool prop() const
|
bool prop() const
|
||||||
{
|
{
|
||||||
return m_prop;
|
return m_prop;
|
||||||
@ -193,7 +204,7 @@ public:
|
|||||||
// error checking if required
|
// error checking if required
|
||||||
m_prop = _prop
|
m_prop = _prop
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
// declare with default value
|
// declare with default value
|
||||||
bool m_prop = false;
|
bool m_prop = false;
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user