equal
deleted
inserted
replaced
329 Q_D(HbRichTextItem); |
329 Q_D(HbRichTextItem); |
330 if (d->mText != text) { |
330 if (d->mText != text) { |
331 d->mText = text; |
331 d->mText = text; |
332 d->mRtf->setHtml(text); |
332 d->mRtf->setHtml(text); |
333 d->clearPrefSizeCache(); |
333 d->clearPrefSizeCache(); |
|
334 update(); |
334 updateGeometry(); |
335 updateGeometry(); |
335 } |
336 } |
336 } |
337 } |
337 |
338 |
338 /*! |
339 /*! |
354 */ |
355 */ |
355 void HbRichTextItem::setAlignment(Qt::Alignment alignment) |
356 void HbRichTextItem::setAlignment(Qt::Alignment alignment) |
356 { |
357 { |
357 Q_D(HbRichTextItem); |
358 Q_D(HbRichTextItem); |
358 d->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, true); |
359 d->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, true); |
359 alignment &= Qt::AlignVertical_Mask | Qt::AlignHorizontal_Mask; |
360 alignment = d->combineAlignment(alignment, d->mTextOption.alignment()); |
360 if (d->mTextOption.alignment()!=alignment) { |
361 if (d->mTextOption.alignment()!=alignment) { |
361 prepareGeometryChange(); |
362 prepareGeometryChange(); |
362 d->mTextOption.setAlignment(alignment); |
363 d->mTextOption.setAlignment(alignment); |
363 d->mRtf->setDefaultTextOption(d->mTextOption); |
364 d->mRtf->setDefaultTextOption(d->mTextOption); |
364 d->calculateOffset(); |
365 d->calculateOffset(); |
386 { |
387 { |
387 Q_UNUSED(widget); |
388 Q_UNUSED(widget); |
388 |
389 |
389 Q_D(HbRichTextItem); |
390 Q_D(HbRichTextItem); |
390 |
391 |
391 // Save painter's state |
392 if (option->exposedRect.isEmpty()) { |
|
393 // nothing to paint |
|
394 return; |
|
395 } |
|
396 |
392 painter->translate(d->mOffset); |
397 painter->translate(d->mOffset); |
|
398 |
393 QAbstractTextDocumentLayout::PaintContext context; |
399 QAbstractTextDocumentLayout::PaintContext context; |
394 context.clip = option->exposedRect; |
400 context.clip = option->exposedRect; |
|
401 // painter was translated so it should be compensated |
|
402 context.clip.translate(-d->mOffset); |
|
403 |
395 context.palette.setColor(QPalette::Text, textDefaultColor()); |
404 context.palette.setColor(QPalette::Text, textDefaultColor()); |
|
405 |
396 d->mRtf->documentLayout()->draw(painter, context); |
406 d->mRtf->documentLayout()->draw(painter, context); |
397 |
407 |
|
408 // restore painter |
398 painter->translate(-d->mOffset); |
409 painter->translate(-d->mOffset); |
399 } |
410 } |
400 |
411 |
401 /*! |
412 /*! |
402 \reimp |
413 \reimp |