Changeset View
Standalone View
src/common/KReportAsyncItemBase.h
Show All 20 Lines | |||||
21 | #define KREPORTASYNCITEMBASE_H | 21 | #define KREPORTASYNCITEMBASE_H | ||
22 | 22 | | |||
23 | #include "KReportItemBase.h" | 23 | #include "KReportItemBase.h" | ||
24 | 24 | | |||
25 | class KREPORT_EXPORT KReportAsyncItemBase : public KReportItemBase | 25 | class KREPORT_EXPORT KReportAsyncItemBase : public KReportItemBase | ||
26 | { | 26 | { | ||
27 | Q_OBJECT | 27 | Q_OBJECT | ||
28 | public: | 28 | public: | ||
29 | KReportAsyncItemBase(); | ||||
30 | ~KReportAsyncItemBase(); | ||||
29 | int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override = 0; | 31 | int renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset, const QVariant &data, KReportScriptHandler *script) override = 0; | ||
30 | virtual QVariant realItemData(const QVariant& itemData) const; | 32 | virtual QVariant realItemData(const QVariant& itemData) const; | ||
31 | 33 | | |||
32 | Q_SIGNALS: | 34 | Q_SIGNALS: | ||
33 | void finishedRendering(); | 35 | void finishedRendering(); | ||
36 | | ||||
37 | private: | ||||
38 | class Private; | ||||
staniek: +Q_DISABLE_COPY | |||||
piggz: Does this need added to _all_ QObject derived classes? | |||||
Yes and to all classes with d-pointers even without QObject. Exception are classes having explicitly implemented copy constructors and assignment operators. And e.g. KDbTableSchema and KDbQuerySchema have some custom constructors that are close to copy constructors but still use Q_DISABLE_COPY because we don't want assignments for them or copying on construction. The rule above is not limited to classes having d-pointers but I routinely iterated over d-pointers in KReport and elsewhere to add Q_DISABLE_COPY. It can be true that also class not having a d-pointer should have Q_DISABLE_COPY set: 1. when 'by design' we don't want copying, 2. when compiler's default implementation of copy constructor's and assignment operator will be just wrong because e.g. we're allocating an attribute on heap (copying only copies the pointer then --> crash) See also https://community.kde.org/Kexi/Junior_Jobs/Add_d-pointers and the Qt docs. staniek: Yes and to all classes with d-pointers even without QObject. Exception are classes having… | |||||
39 | Private * const d; | ||||
34 | }; | 40 | }; | ||
35 | 41 | | |||
36 | #endif // KREPORTASYNCITEMBASE_H | 42 | #endif // KREPORTASYNCITEMBASE_H |
+Q_DISABLE_COPY