Coding Standards
From ParaQ Wiki
Jump to navigationJump to search
Style
We'll adhere to VTK coding standards except where noted here.
- Qt derived classes will follow Qt style for member functions. We don't want to mix two styles in one class (Qt virtual overloads & VTK style).
- Avoid multiple inheritance of Qt & VTK classes. Style in such classes would be mixed. Besides, object management is not compatible (VTK's A::New, a->Delete vs. Qt's new A(), nothing).
- Member variables will follow VTK style. In contrast, Qt headers do one of two things: use '_' prefix to prevent collisions with get methods of the same name, hide all data in an internals class/struct. Using the VTK style will lead to more readable code.
Here's an example class
class pqMyWidget : public QWidget { Q_OBJECT Q_PROPERTY(QString property READ property WRITE setProperty) public: pqMyWidget(QWidget* parent); ~pqMyWidget(); virtual bool paintEvent(QPaintEvent* e); QString property() const; void setProperty(QString s); protected: QString Property; };