Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportDesigner.cpp
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Line(s) | 70 | public: | |||
---|---|---|---|---|---|
101 | QList<KReportDesignerItemBase*> copy_list; | 101 | QList<KReportDesignerItemBase*> copy_list; | ||
102 | QList<KReportDesignerItemBase*> cut_list; | 102 | QList<KReportDesignerItemBase*> cut_list; | ||
103 | }; | 103 | }; | ||
104 | 104 | | |||
105 | //! @internal | 105 | //! @internal | ||
106 | class Q_DECL_HIDDEN KReportDesigner::Private | 106 | class Q_DECL_HIDDEN KReportDesigner::Private | ||
107 | { | 107 | { | ||
108 | public: | 108 | public: | ||
109 | Private() | 109 | Private(){} | ||
110 | : activeScene(0) | | |||
111 | , reportHeader(0) | | |||
112 | , pageHeaderFirst(0) | | |||
113 | , pageHeaderOdd(0) | | |||
114 | , pageHeaderEven(0) | | |||
115 | , pageHeaderLast(0) | | |||
116 | , pageHeaderAny(0) | | |||
117 | , pageFooterFirst(0) | | |||
118 | , pageFooterOdd(0) | | |||
119 | , pageFooterEven(0) | | |||
120 | , pageFooterLast(0) | | |||
121 | , pageFooterAny(0) | | |||
122 | , reportFooter(0) | | |||
123 | , detail(0) | | |||
124 | , pressX(-1) | | |||
125 | , pressY(-1) | | |||
126 | , releaseX(-1) | | |||
127 | , releaseY(-1) | | |||
128 | , modified(false) | | |||
129 | , kordata(0) | | |||
130 | {} | | |||
131 | 110 | | |||
132 | ~Private() | 111 | ~Private() | ||
133 | { | 112 | { | ||
134 | delete zoom; | 113 | delete zoom; | ||
135 | delete sectionData; | 114 | delete sectionData; | ||
136 | delete set; | 115 | delete set; | ||
137 | delete kordata; | 116 | delete kordata; | ||
138 | } | 117 | } | ||
139 | 118 | | |||
140 | QGridLayout *grid; | 119 | QGridLayout *grid; | ||
141 | KReportRuler *hruler; | 120 | KReportRuler *hruler; | ||
142 | KReportZoomHandler *zoom; | 121 | KReportZoomHandler *zoom; | ||
143 | QVBoxLayout *vboxlayout; | 122 | QVBoxLayout *vboxlayout; | ||
144 | KReportPropertiesButton *pageButton; | 123 | KReportPropertiesButton *pageButton; | ||
staniek: I propose to mark false positives for members that are initialized in KReportDesigner::init()… | |||||
145 | 124 | | |||
146 | QGraphicsScene *activeScene; | 125 | QGraphicsScene *activeScene = nullptr; | ||
147 | 126 | | |||
148 | ReportWriterSectionData *sectionData; | 127 | ReportWriterSectionData *sectionData; | ||
149 | 128 | | |||
150 | KReportDesignerSection *reportHeader; | 129 | KReportDesignerSection *reportHeader = nullptr; | ||
151 | KReportDesignerSection *pageHeaderFirst; | 130 | KReportDesignerSection *pageHeaderFirst = nullptr; | ||
152 | KReportDesignerSection *pageHeaderOdd; | 131 | KReportDesignerSection *pageHeaderOdd = nullptr; | ||
153 | KReportDesignerSection *pageHeaderEven; | 132 | KReportDesignerSection *pageHeaderEven = nullptr; | ||
154 | KReportDesignerSection *pageHeaderLast; | 133 | KReportDesignerSection *pageHeaderLast = nullptr; | ||
155 | KReportDesignerSection *pageHeaderAny; | 134 | KReportDesignerSection *pageHeaderAny = nullptr; | ||
156 | 135 | | |||
157 | KReportDesignerSection *pageFooterFirst; | 136 | KReportDesignerSection *pageFooterFirst = nullptr; | ||
158 | KReportDesignerSection *pageFooterOdd; | 137 | KReportDesignerSection *pageFooterOdd = nullptr; | ||
159 | KReportDesignerSection *pageFooterEven; | 138 | KReportDesignerSection *pageFooterEven = nullptr; | ||
160 | KReportDesignerSection *pageFooterLast; | 139 | KReportDesignerSection *pageFooterLast = nullptr; | ||
161 | KReportDesignerSection *pageFooterAny; | 140 | KReportDesignerSection *pageFooterAny = nullptr; | ||
162 | KReportDesignerSection *reportFooter; | 141 | KReportDesignerSection *reportFooter = nullptr; | ||
163 | KReportDesignerSectionDetail *detail; | 142 | KReportDesignerSectionDetail *detail = nullptr; | ||
164 | 143 | | |||
165 | //Properties | 144 | //Properties | ||
166 | KPropertySet *set; | 145 | KPropertySet *set; | ||
167 | KPropertySet *itmset; | 146 | KPropertySet *itmset; | ||
168 | KProperty *title; | 147 | KProperty *title; | ||
169 | KProperty *pageSize; | 148 | KProperty *pageSize; | ||
170 | KProperty *orientation; | 149 | KProperty *orientation; | ||
171 | KProperty *unit; | 150 | KProperty *unit; | ||
Show All 16 Lines | 163 | #endif | |||
188 | QAction *editCopyAction; | 167 | QAction *editCopyAction; | ||
189 | QAction *editPasteAction; | 168 | QAction *editPasteAction; | ||
190 | QAction *editDeleteAction; | 169 | QAction *editDeleteAction; | ||
191 | QAction *sectionEdit; | 170 | QAction *sectionEdit; | ||
192 | QAction *parameterEdit; | 171 | QAction *parameterEdit; | ||
193 | QAction *itemRaiseAction; | 172 | QAction *itemRaiseAction; | ||
194 | QAction *itemLowerAction; | 173 | QAction *itemLowerAction; | ||
195 | 174 | | |||
196 | qreal pressX; | 175 | qreal pressX = -1; | ||
197 | qreal pressY; | 176 | qreal pressY = -1; | ||
198 | qreal releaseX; | 177 | qreal releaseX = -1; | ||
199 | qreal releaseY; | 178 | qreal releaseY = -1; | ||
200 | 179 | | |||
201 | bool modified; // true if this document has been modified, false otherwise | 180 | bool modified = false; // true if this document has been modified, false otherwise | ||
202 | 181 | | |||
203 | QString originalInterpreter; //Value of the script interpreter at load time | 182 | QString originalInterpreter; //Value of the script interpreter at load time | ||
204 | QString originalScript; //Value of the script at load time | 183 | QString originalScript; //Value of the script at load time | ||
205 | 184 | | |||
206 | KReportData *kordata; | 185 | KReportData *kordata = nullptr; | ||
207 | }; | 186 | }; | ||
208 | 187 | | |||
209 | KReportDesigner::KReportDesigner(QWidget * parent) | 188 | KReportDesigner::KReportDesigner(QWidget * parent) | ||
210 | : QWidget(parent), d(new Private()) | 189 | : QWidget(parent), d(new Private()) | ||
211 | { | 190 | { | ||
212 | init(); | 191 | init(); | ||
213 | } | 192 | } | ||
214 | 193 | | |||
▲ Show 20 Lines • Show All 952 Lines • ▼ Show 20 Line(s) | 1136 | if (!d->sectionData->copy_list.isEmpty()) { | |||
1167 | //! The setPos calls only work AFTER the name has been set ?!?!? | 1146 | //! The setPos calls only work AFTER the name has been set ?!?!? | ||
1168 | 1147 | | |||
1169 | foreach(KReportDesignerItemBase *item, d->sectionData->copy_list) { | 1148 | foreach(KReportDesignerItemBase *item, d->sectionData->copy_list) { | ||
1170 | KReportItemBase *obj = dynamic_cast<KReportItemBase*>(item); | 1149 | KReportItemBase *obj = dynamic_cast<KReportItemBase*>(item); | ||
1171 | const QString type = obj ? obj->typeName() : QLatin1String("object"); | 1150 | const QString type = obj ? obj->typeName() : QLatin1String("object"); | ||
1172 | //kreportDebug() << type; | 1151 | //kreportDebug() << type; | ||
1173 | KReportDesignerItemBase *ent = item->clone(); | 1152 | KReportDesignerItemBase *ent = item->clone(); | ||
1174 | KReportItemBase *new_obj = dynamic_cast<KReportItemBase*>(ent); | 1153 | KReportItemBase *new_obj = dynamic_cast<KReportItemBase*>(ent); | ||
1154 | if (new_obj) { | ||||
1175 | new_obj->setEntityName(suggestEntityName(type)); | 1155 | new_obj->setEntityName(suggestEntityName(type)); | ||
1176 | if (activeItem) { | 1156 | if (activeItem) { | ||
1177 | new_obj->setPosition(KReportItemBase::positionFromScene(QPointF(activeItem->x() + 10, activeItem->y() + 10))); | 1157 | new_obj->setPosition(KReportItemBase::positionFromScene(QPointF(activeItem->x() + 10, activeItem->y() + 10))); | ||
1178 | } else { | 1158 | } else { | ||
1179 | new_obj->setPosition(KReportItemBase::positionFromScene(QPointF(0, 0))); | 1159 | new_obj->setPosition(KReportItemBase::positionFromScene(QPointF(0, 0))); | ||
1180 | } | 1160 | } | ||
1181 | changeSet(new_obj->propertySet()); | 1161 | changeSet(new_obj->propertySet()); | ||
1162 | } | ||||
1182 | QGraphicsItem *pasted_ent = dynamic_cast<QGraphicsItem*>(ent); | 1163 | QGraphicsItem *pasted_ent = dynamic_cast<QGraphicsItem*>(ent); | ||
1183 | if (pasted_ent) { | 1164 | if (pasted_ent) { | ||
1184 | pasted_ent->setSelected(true); | 1165 | pasted_ent->setSelected(true); | ||
1185 | canvas->addItem(pasted_ent); | 1166 | canvas->addItem(pasted_ent); | ||
1186 | pasted_ent->show(); | 1167 | pasted_ent->show(); | ||
1187 | d->sectionData->mouseAction = ReportWriterSectionData::MA_Grab; | 1168 | d->sectionData->mouseAction = ReportWriterSectionData::MA_Grab; | ||
1188 | setModified(true); | 1169 | setModified(true); | ||
1189 | } | 1170 | } | ||
▲ Show 20 Lines • Show All 364 Lines • Show Last 20 Lines |
I propose to mark false positives for members that are initialized in KReportDesigner::init() and don't initialize here.
Summing up, if we fake-initialize just to silent the Coverity here we can miss the fact that we forget to allocate an object when we change KReportDesigner::init(), it would not be noticed.