The code looks fine and is almost complete.
First, please make sure that the DXF file can be found and there are no other errors. The return value of importFile should be 0, if the import was successful.
After the import, the scenes and views have to be regenerated with:
Performing an auto zoom is usually also a good idea:
This simple example could look like this in ECMAScript (as standalone application):
var storage = new RMemoryStorage();
var spatialIndex = new RSpatialIndexNavel();
var document = new RDocument(storage, spatialIndex);
var view = new RGraphicsViewQt();
var documentInterface = new RDocumentInterface(document);
var scene = new RGraphicsSceneQt(documentInterface);
documentInterface.importFile("/path/to/file/dummy.dxf", "DXF 2000");
It can be run like this:
./qcad -autostart dummy.js
Scripts can access the entire API of QCAD and almost all of Qt. Using C++, you would likely sooner or later get to a point where you would have to re-implement some of the QCAD code written in ECMAScript (most of the user interface related code, all of the tools and most widgets are implemented in ECMAScript).