Previous lines use `dynamic_cast<Layout*>` for widget, Layout is inherited from `Widget`.
This line still to check whether it's a `Widget` class. The logic is wrong.