[Qt-interest] Fwd: Re: adding another item in QGraphicsItem
chandrasekar wagmare
sekarwagmare at gmail.com
Sat Apr 25 13:32:55 CEST 2009
and that one also i solved using
void QGraphicsTextItem::setDefaultTextColor ( const QColor <qcolor.html>&
col )
On Sat, Apr 25, 2009 at 4:44 PM, chandrasekar wagmare <
sekarwagmare at gmail.com> wrote:
ProgressItem::ProgressItem(const QRectF &rect)
> : QGraphicsRectItem(rect)
> {
> textItem = new QGraphicsTextItem(this);
>
> textItem->setPos(10, 4);
> textItem->setPlainText("In Progress");
>
> }
>
>
> void ProgressItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
> *o, QWidget *widget)
> {
> QBrush brush(QColor(Qt::yellow));
> painter->setBrush(QBrush(QColor(21, 155, 210, 255)));
> painter->drawRect(rect());
>
> }
>
> i tried this one and its working .... the only problem is the text color
>
>
>
> On Sat, Apr 25, 2009 at 4:21 PM, Sean Harmer <
> sean.harmer at maps-technology.com> wrote:
>
>> Forwarding to list. Sorry I didn't check the reply-to address...
>> ---------- Forwarded Message ----------
>>
>> Subject: Re: [Qt-interest] adding another item in QGraphicsItem
>> Date: Saturday 25 Apr 2009
>> From: Sean Harmer <sean.harmer at maps-technology.com>
>> To: chandrasekar wagmare <sekarwagmare at gmail.com>
>>
>> On Saturday 25 April 2009 10:34:25 you wrote:
>> > 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() .....
>> Just try it. Child items get drawn on top of their parents. Please read
>> the
>> docs and examples for QGraphicsItem.
>>
>> Another alternative is to simply use QPainter::drawText() in your custom
>> item's paint() function. Either way will work. It depends if
>> QGraphicsTextItem
>> satisfies your requirements.
>>
>> Sean
>>
>>
>> -------------------------------------------------------
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
>
> --
> CHANDRU
>
--
CHANDRU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090425/9f3122fc/attachment.html
More information about the Qt-interest-old
mailing list