RenderObjectPtr<Text> RenderObject::addText(const Common::String &font, const Common::String &text) { RenderObjectPtr<Text> textPtr((new Text(this->getHandle()))->getHandle()); if (textPtr.isValid() && textPtr->getInitSuccess() && textPtr->setFont(font)) { textPtr->setText(text); return textPtr; } else { if (textPtr.isValid()) textPtr.erase(); return RenderObjectPtr<Text>(); } }
void writeToSymbianStoreLX(const QMimeData* aData, CClipboard* clipboard) { // This function both leaves and throws exceptions. There must be no destructor // dependencies between cleanup styles, and no cleanup stack dependencies on stacked objects. if (aData->hasText()) { CPlainText* text = CPlainText::NewL(); CleanupStack::PushL(text); TPtrC textPtr(qt_QString2TPtrC(aData->text())); text->InsertL(KPlainTextBegin, textPtr); text->CopyToStoreL(clipboard->Store(), clipboard->StreamDictionary(), KPlainTextBegin, textPtr.Length()); CleanupStack::PopAndDestroy(text); } }
void FrameView::insertFrame( const Frame& FrameRef, const QString& Description, const QPointF& Offset ) { if (FrameRef.empty()) return; QGraphicsPixmapItem* pixMapPtr(Scene->addPixmap(FrameRef)); pixMapPtr->setOffset(Offset); QRectF textRect; if (!Description.isEmpty()) { QGraphicsSimpleTextItem* textPtr(Scene->addSimpleText(Description)); textRect = textPtr->boundingRect(); textPtr->setPos(Offset + QPointF((FrameRef.width() - textRect.width())/2, FrameRef.height())); } LastOffset = Offset; LastSize.setWidth(FrameRef.width()); LastSize.setHeight(FrameRef.height() + textRect.height()); MaxFrameWidth = qMax(MaxFrameWidth, static_cast<int>(LastOffset.x() + LastSize.width())); }