Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportDesignerItemRectBase.cpp
Show All 27 Lines | |||||
28 | 28 | | |||
29 | class Q_DECL_HIDDEN KReportDesignerItemRectBase::Private | 29 | class Q_DECL_HIDDEN KReportDesignerItemRectBase::Private | ||
30 | { | 30 | { | ||
31 | public: | 31 | public: | ||
32 | Private(); | 32 | Private(); | ||
33 | ~Private(); | 33 | ~Private(); | ||
34 | 34 | | |||
35 | int grabAction = 0; | 35 | int grabAction = 0; | ||
36 | int dpiX = KReportPrivate::dpiX(); | ||||
37 | int dpiY = KReportPrivate::dpiY(); | ||||
36 | }; | 38 | }; | ||
37 | 39 | | |||
38 | KReportDesignerItemRectBase::Private::Private() | 40 | KReportDesignerItemRectBase::Private::Private() | ||
39 | { | 41 | { | ||
staniek: Could `int dpiX = KReportPrivate::dpiX();` be written above instead? Same for dpiY. | |||||
40 | } | 42 | } | ||
41 | 43 | | |||
staniek: Ah and this one is not needed, already wrote `int grabAction = 0;` above | |||||
42 | KReportDesignerItemRectBase::Private::~Private() | 44 | KReportDesignerItemRectBase::Private::~Private() | ||
43 | { | 45 | { | ||
44 | } | 46 | } | ||
45 | 47 | | |||
46 | KReportDesignerItemRectBase::KReportDesignerItemRectBase(KReportDesigner *r, KReportItemBase *b) | 48 | KReportDesignerItemRectBase::KReportDesignerItemRectBase(KReportDesigner *r, KReportItemBase *b) | ||
47 | : QGraphicsRectItem(), KReportDesignerItemBase(r, b), d(new KReportDesignerItemRectBase::Private) | 49 | : QGraphicsRectItem(), KReportDesignerItemBase(r, b), d(new KReportDesignerItemRectBase::Private) | ||
staniek: BTW `new Private` is enough | |||||
48 | { | 50 | { | ||
49 | m_dpiX = KReportPrivate::dpiX(); | | |||
50 | m_dpiY = KReportPrivate::dpiY(); | | |||
51 | | ||||
52 | d->grabAction = 0; | | |||
53 | setAcceptHoverEvents(true); | 51 | setAcceptHoverEvents(true); | ||
staniek: Now it's a bit safer to move these initializations to Private(). | |||||
54 | | ||||
55 | setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges); | 52 | setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges); | ||
56 | } | 53 | } | ||
57 | 54 | | |||
58 | KReportDesignerItemRectBase::~KReportDesignerItemRectBase() | 55 | KReportDesignerItemRectBase::~KReportDesignerItemRectBase() | ||
59 | { | 56 | { | ||
60 | delete d; | 57 | delete d; | ||
61 | } | 58 | } | ||
62 | 59 | | |||
▲ Show 20 Lines • Show All 327 Lines • ▼ Show 20 Line(s) | 380 | { | |||
390 | } else { | 387 | } else { | ||
391 | if (itemType.isEmpty()) { | 388 | if (itemType.isEmpty()) { | ||
392 | setRenderText(itemDataSource); | 389 | setRenderText(itemDataSource); | ||
393 | } else { | 390 | } else { | ||
394 | setRenderText(dataSourceAndObjectTypeName(itemDataSource, itemType)); | 391 | setRenderText(dataSourceAndObjectTypeName(itemDataSource, itemType)); | ||
395 | } | 392 | } | ||
396 | } | 393 | } | ||
397 | } | 394 | } | ||
395 | | ||||
396 | int KReportDesignerItemRectBase::dpiX() const | ||||
397 | { | ||||
398 | return d->dpiX; | ||||
399 | } | ||||
400 | | ||||
401 | int KReportDesignerItemRectBase::dpiY() const | ||||
402 | { | ||||
403 | return d->dpiY; | ||||
404 | } |
Could int dpiX = KReportPrivate::dpiX(); be written above instead? Same for dpiY.