diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-05-14 20:42:01 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-05-15 11:03:53 +0200 |
commit | 8ab4d2028f971dcddd53fa0fc9313f5abe491fa2 (patch) | |
tree | 9950032ee62a1d42a32821d264d562692b1d0a91 /examples/widgets/painting/composition/composition.h | |
parent | 4469e36d7203a55a4e158a50f0e9effc3f2fa3c2 (diff) |
Composition example: use std::unique_ptr instead of QScopedPointer
The use of a unique_ptr member requires that the destructor be
out-of-line, since the payload is only forward-declared in the header
file. This is good hygiene, so do it for CompositionWidget, too.
Add 'explicit' and missing = nullptr to both constructors as a
drive-by.
Change-Id: Ied1c89864f90d3f2c13fb4e9a8bbbe2e6fd6f1d7
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'examples/widgets/painting/composition/composition.h')
-rw-r--r-- | examples/widgets/painting/composition/composition.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/widgets/painting/composition/composition.h b/examples/widgets/painting/composition/composition.h index 19150e2024..52ca7919b0 100644 --- a/examples/widgets/painting/composition/composition.h +++ b/examples/widgets/painting/composition/composition.h @@ -61,6 +61,8 @@ #include <QPainter> #include <QEvent> +#include <memory> + QT_BEGIN_NAMESPACE class QPushButton; class QRadioButton; @@ -71,7 +73,8 @@ class CompositionWidget : public QWidget Q_OBJECT public: - CompositionWidget(QWidget *parent); + explicit CompositionWidget(QWidget *parent = nullptr); + ~CompositionWidget(); public slots: void nextMode(); @@ -117,7 +120,8 @@ class CompositionRenderer : public ArthurFrame Q_PROPERTY(bool animation READ animationEnabled WRITE setAnimationEnabled) public: - CompositionRenderer(QWidget *parent); + explicit CompositionRenderer(QWidget *parent = nullptr); + ~CompositionRenderer(); void paint(QPainter *) override; @@ -188,7 +192,7 @@ private: int m_animationTimer; #if QT_CONFIG(opengl) - QScopedPointer<QFboPaintDevice> m_fbo; + std::unique_ptr<QFboPaintDevice> m_fbo; int m_pbuffer_size; // width==height==size of pbuffer uint m_base_tex; uint m_compositing_tex; |