Move remaining memebers of KReportDesignerItemRectBase to dptr
ClosedPublic

Authored by piggz on Aug 31 2017, 9:03 PM.

Diff Detail

Repository
R14 KReport
Branch
last-dptr
Lint
No Linters Available
Unit
No Unit Test Coverage
piggz created this revision.Aug 31 2017, 9:03 PM
Restricted Application added a project: KReport. · View Herald TranscriptAug 31 2017, 9:03 PM
staniek requested changes to this revision.Sep 1 2017, 9:35 AM
staniek added inline comments.
src/common/KReportAsyncItemBase.cpp
28

Missing dtor and delete d

src/common/KReportAsyncItemBase.h
38

+Q_DISABLE_COPY

src/wrtembed/KReportDesignerItemRectBase.cpp
52–53

Now it's a bit safer to move these initializations to Private().

src/wrtembed/KReportDesignerItemRectBase.h
73

+const

74

+const

This revision now requires changes to proceed.Sep 1 2017, 9:35 AM
piggz marked 5 inline comments as done.Sep 1 2017, 9:35 PM
piggz added inline comments.
src/common/KReportAsyncItemBase.h
38

Does this need added to _all_ QObject derived classes?

piggz updated this revision to Diff 19075.Sep 1 2017, 9:36 PM
piggz edited edge metadata.
piggz marked an inline comment as done.
  • Address comments
staniek requested changes to this revision.Sep 1 2017, 10:11 PM
staniek added inline comments.
src/common/KReportAsyncItemBase.cpp
22

-> class Q_DECL_HIDDEN

src/common/KReportAsyncItemBase.h
38

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.

src/wrtembed/KReportDesignerItemRectBase.cpp
41

Could int dpiX = KReportPrivate::dpiX(); be written above instead? Same for dpiY.

43

Ah and this one is not needed, already wrote int grabAction = 0; above

This revision now requires changes to proceed.Sep 1 2017, 10:11 PM
piggz marked 3 inline comments as done.Sep 2 2017, 7:15 AM
piggz updated this revision to Diff 19189.Sep 4 2017, 8:03 PM
piggz edited edge metadata.
  • Move sections to d ptr
staniek requested changes to this revision.Sep 4 2017, 8:12 PM

Minor questions

src/common/KReportDocument.cpp
55 ↗(On Diff #19189)

I miss detailSection initialization for this ctor. Am I right?

src/wrtembed/KReportDesignerItemRectBase.cpp
51

BTW new Private is enough

This revision now requires changes to proceed.Sep 4 2017, 8:12 PM
piggz updated this revision to Diff 19190.Sep 4 2017, 8:17 PM
piggz edited edge metadata.
  • Minor fixes
staniek accepted this revision.Sep 4 2017, 8:19 PM

Cool :)

This revision is now accepted and ready to land.Sep 4 2017, 8:19 PM
This revision was automatically updated to reflect the committed changes.