Use virtual function instead of if/qobject_cast cascades.
Attach a file by drag & drop or click to upload