https://bugs.kde.org/show_bug.cgi?id=386134

--- Comment #2 from Roman <dism...@gmail.com> ---
See, this cast function is very tricky. Let's imagine such an hierarchy:

class Bar : public QGraphicsItem
{
    virtual int type() const Q_DECL_OVERRIDE {return Type;}
    enum { Type = UserType + 1};
};

class Foo : public Bar
{
    virtual int type() const Q_DECL_OVERRIDE {return Type;}
    enum { Type = UserType + 2};
};

Foo *f = new Foo();

Bar *b = f;

b->type() == f->type();

Because the type() function is virtual in both cases you will get the same
result from Foo::type(). This looks obvious. But what if i want use
qgraphicsitem_cast like this:

QGraphicsItem *p = new Foo();
Bar *parent = qgraphicsitem_cast<Bar *>(p);

It will not work! qgraphicsitem_cast can only cast to Foo in this case. If i
want to cast to Bar i must not to reimplement the type() function in Foo.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to