qt

Qt Framework

Qt framework patterns for C++ GUI and application development

Details

Language / Topic
cppC++
Category
framework
Compatible Frameworks
qt

Rules

balanced
- Use Qt's signal-slot mechanism for decoupled event communication between objects.
- Use Qt's parent-child ownership model for automatic memory management — children are deleted when parent is destroyed.
- Use `Q_OBJECT` macro in every QObject subclass to enable signals/slots, properties, and the meta-object system.
- Prefer QML for UI layouts with C++ backend logic exposed via `Q_PROPERTY` and `Q_INVOKABLE` methods.
- Use `QObject::connect()` with type-safe functor syntax over string-based `SIGNAL`/`SLOT` macros.
- Keep UI logic in QML/widgets and business logic in C++ classes — separate concerns cleanly.
- Use Qt containers (`QList`, `QString`, `QHash`) for Qt API interop, but prefer STL containers for non-Qt code.
- Structure projects with separate `src/`, `qml/`, `resources/`, and `tests/` directories.