equal
deleted
inserted
replaced
117 */ |
117 */ |
118 NmAttachmentListWidget::~NmAttachmentListWidget( ) |
118 NmAttachmentListWidget::~NmAttachmentListWidget( ) |
119 { |
119 { |
120 NM_FUNCTION; |
120 NM_FUNCTION; |
121 |
121 |
|
122 qDeleteAll(mItemList); |
|
123 |
122 mItemList.clear(); |
124 mItemList.clear(); |
|
125 |
123 } |
126 } |
124 |
127 |
125 /*! |
128 /*! |
126 Setter for items text color override. This fucntion can be used |
129 Setter for items text color override. This fucntion can be used |
127 if theme background is not used and text needs to be shown in diferent color. |
130 if theme background is not used and text needs to be shown in diferent color. |
255 NM_FUNCTION; |
258 NM_FUNCTION; |
256 |
259 |
257 Q_UNUSED(option); |
260 Q_UNUSED(option); |
258 Q_UNUSED(widget); |
261 Q_UNUSED(widget); |
259 if (painter&&mLayout){ |
262 if (painter&&mLayout){ |
|
263 painter->save(); |
|
264 |
260 // Use text color as a line color if set, otherwise use theme |
265 // Use text color as a line color if set, otherwise use theme |
261 // normal list content color. |
266 // normal list content color. |
262 if (mTextColor.isValid()){ |
267 if (mTextColor.isValid()){ |
263 painter->setPen(mTextColor); |
268 painter->setPen(mTextColor); |
264 } |
269 } |
278 QRectF itemRect = item->geometry(); |
283 QRectF itemRect = item->geometry(); |
279 QLineF line1( itemRect.topLeft().x(), itemRect.bottomRight().y(), |
284 QLineF line1( itemRect.topLeft().x(), itemRect.bottomRight().y(), |
280 layoutRect.bottomRight().x(), itemRect.bottomRight().y()); |
285 layoutRect.bottomRight().x(), itemRect.bottomRight().y()); |
281 painter->drawLine(line1); |
286 painter->drawLine(line1); |
282 } |
287 } |
283 } |
288 } |
|
289 painter->restore(); |
284 } |
290 } |
285 } |
291 } |
286 |
292 |
287 /*! |
293 /*! |
288 Public slot connected to set items value. Shows progress bar when called |
294 Public slot connected to set items value. Shows progress bar when called |
316 } |
322 } |
317 |
323 |
318 //construct UI after orientation has been figured out |
324 //construct UI after orientation has been figured out |
319 constructUi(); |
325 constructUi(); |
320 |
326 |
321 //set default values, needed? |
327 //set flags |
322 setFlag(QGraphicsItem::ItemIsFocusable); |
328 setFlag(QGraphicsItem::ItemIsFocusable); |
|
329 setFlag(QGraphicsItem::ItemHasNoContents,false); |
323 } |
330 } |
324 |
331 |
325 /*! |
332 /*! |
326 Helper function for constructing UI components. |
333 Helper function for constructing UI components. |
327 */ |
334 */ |
337 QObjectList objectList; |
344 QObjectList objectList; |
338 objectList.append(this); |
345 objectList.append(this); |
339 loader.setObjectTree(objectList); |
346 loader.setObjectTree(objectList); |
340 QObjectList widgetlist = loader.load(FILE_PATH_DOCML, &loadingOk); |
347 QObjectList widgetlist = loader.load(FILE_PATH_DOCML, &loadingOk); |
341 |
348 |
342 int widgetCount = widgetlist.count(); |
349 if(loadingOk){ |
343 if(loadingOk && widgetCount){ |
|
344 if(layout()){ |
350 if(layout()){ |
345 mLayout = dynamic_cast<QGraphicsGridLayout*>(layout()); |
351 mLayout = dynamic_cast<QGraphicsGridLayout*>(layout()); |
346 mLayout->setContentsMargins(0,0,0,0); |
352 mLayout->setContentsMargins(0,0,0,0); |
347 } else { |
353 } else { |
348 NM_ERROR(1,"NmAttachmentListWidget::constructUi: Widget doesn't have layout!"); |
354 NM_ERROR(1,"NmAttachmentListWidget::constructUi: Widget doesn't have layout!"); |