Don't use c style cast when dealing with QObject derived class, there qobjec_cast for that.

The parent of DrawWidget is probably not what you think it is.

You are creating a tight coupling with the parent which is a bad idea. The parent object should be responsible for modifying it's child/children. The child widget should not try to change itself based on the parent it has.