It will not be directly possible to do so, as you have protected inheritance. The very point of having protected inheritance is to hide public functions, without exposing the public function of QGraphicsObject you will not be to use it / add it to any scene.
Well there is a work around 
class MyObject : protected QGraphicsObject{};
MyObject my_object;
QGraphicsObject* gra_object= reinterpret_cast<QGraphicsObject*>(&my_object); // C++ style, static & dynamic cast will not work, as they obey strict type and visibility rules. dynamic cast overrides them
//QGraphicsObject* gra_object= (QGraphicsObject*)(&my_object); // C Style, not recommended, but works
_scene->addItem(gra_object);
class MyObject : protected QGraphicsObject{};
MyObject my_object;
QGraphicsObject* gra_object= reinterpret_cast<QGraphicsObject*>(&my_object); // C++ style, static & dynamic cast will not work, as they obey strict type and visibility rules. dynamic cast overrides them
//QGraphicsObject* gra_object= (QGraphicsObject*)(&my_object); // C Style, not recommended, but works
_scene->addItem(gra_object);
To copy to clipboard, switch view to plain text mode
Bookmarks