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

Qt-interest Archive, May 2007
Question about elastic nodes example.


Message 1 in thread

Hello.

Who can explain some feature in qt4.2 example (Elastic_Nodes).
In Class Node there is function Paint. 
One of parameters of this function is "option" 
of type QStyleOptionGraphicsItem*.
When i try to print the type of parameter *option, it is SO_Default (0).

Why?

It seems to me, that it must have type 17 (SO_Graphics_Item)?


void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *)
{
    printf ("\n type= %d\n", option->type);  //  <------ prints zero.

    painter->setPen(Qt::NoPen);
    painter->setBrush(Qt::darkGray);
    painter->drawEllipse(-7, -7, 20, 20);

    QRadialGradient gradient(-3, -3, 10);
    if (option->state & QStyle::State_Sunken) {
        gradient.setCenter(3, 3);
        gradient.setFocalPoint(3, 3);
        gradient.setColorAt(1, QColor(Qt::yellow).light(120));
        gradient.setColorAt(0, QColor(Qt::darkYellow).light(120));
    } else {
        gradient.setColorAt(0, Qt::yellow);
        gradient.setColorAt(1, Qt::darkYellow);
    }
    painter->setBrush(gradient);
    painter->setPen(QPen(Qt::black, 0));
    painter->drawEllipse(-10, -10, 20, 20);
}


in console i see:

type= 0
type= 0
type= 0
type= 0
type= 0

can anybody help?

Thanks.

P.S. S


-- 
 [ signature omitted ]