[Qt-interest] adding another item in QGraphicsItem

chandrasekar wagmare sekarwagmare at gmail.com
Sat Apr 25 11:34:25 CEST 2009


thanks for reply ..

 if we paint will it overwrite the item..? because the item should be a
rectangle with brush of blue color and will it over write the
QGraphicsTextItem() .....

On Sat, Apr 25, 2009 at 1:59 PM, Sean Harmer <
sean.harmer at maps-technology.com> wrote:

> On Saturday 25 April 2009 07:47:44 chandrasekar wagmare wrote:
> > hi friends,
> >           i am designing a QGraphicsView having several customized
> > QGraphicsRectItem ...
> >
> >    one of the customized item is ProgressItem
> >
> >
> > ProgressItem::ProgressItem(const QRectF &rect)
> >
> >             : QGraphicsRectItem(rect)
> >
> > i will construct it in QGraphicsScene with QRectF(0, 0, 80, 40)
> >
> > my doubt is ..." how can i insert a QGraphicsTextItem inside the
> > QGraphicsRectItem ...
> >
> > previously i use  :paint(QPainter *painter, const
>  QStyleOptionGraphicsItem
> > *o, QWidget *widget)
> >              and use painter->addText();
> >
> > but i dont know how to introduce an new item (QGraphicsTextItem) inside
> the
> > rectItem() ...
> >
> >      can anybody please help me .....
> Erm, have you simply tried constructing a QGraphicsTextItem in the
> constructor
> of your ProgressItem object? Just pass "this" as the parent and position it
> in
> your objects local coordinate system and all should be good.
>
> ProgressItem::ProgressItem(const QRectF &rect)
>  : QGraphicsRectItem( rect )
> {
>        m_textItem = new QGraphicsTextItem( this );
>        // Calculate reasoable x and y coords here...
>        m_textItem->setPos( QPointF( x, y ) );
> }
>
> Sean
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
CHANDRU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090425/737b8edd/attachment.html 


More information about the Qt-interest-old mailing list