Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, June 2007
pen.color() == pen.brush().color() always true?


Message 1 in thread

Is this always true?

pen.color() == pen.brush().color();

Thanks
Lingfa




--
 [ signature omitted ] 

Message 2 in thread

> Is this always true?
>
> pen.color() == pen.brush().color();

It is very cool for questions like this that Qt is a sourcecode
distribution even if you use the binary installers. Use the force! Read
the Source!

Straight from the Qt source code....

QColor QPen::color() const
{
    return d->brush.color();
}

QBrush QPen::brush() const
{
    return d->brush;
}

--Justin

--
 [ signature omitted ] 

Message 3 in thread

>It is very cool for questions like this that Qt is a sourcecode
>distribution even if you use the binary installers. Use the force! Read
>the Source!
>
>Straight from the Qt source code....
>
>QColor QPen::color() const
>{
>    return d->brush.color();
>}
>
>QBrush QPen::brush() const
>{
>    return d->brush;
>}
>
>--Justin
>
>  
>
Yes, thank you remembering me to learn more from the Source.
Lingfa

--
 [ signature omitted ] 

Message 4 in thread

On 14.06.07 13:06:21, justin@xxxxxxx wrote:
> > Is this always true?
> >
> > pen.color() == pen.brush().color();
> 
> It is very cool for questions like this that Qt is a sourcecode
> distribution even if you use the binary installers. Use the force! Read
> the Source!

Or write a small test program:

QPen pen;
pen.setColor( Qt::red );
QBrush b;
b.setColor( Qt::blue );
pen.setBrush( b );
Q_ASSERT( pen.color() == pen.brush().color() );

(not tested)

Andreas

-- 
 [ signature omitted ]