Can qt3d work with qt model/view programming?
-
I am building a 3d molecule editor.
I have a model MoleculeModel(qtAbstractListModel) of molecules to allow changes from the UI.
However, I am not sure how to go about building the 3d scene. I already have a class GraphicsView that derives from qt3dwindow.
The program allows moving molecules in 3d, breaking bonds, etc.
I plan on maintaining good programming standards.My question: Is it advisable to make GraphicsView also inherit from QAbstractItemView? Then override the functions.
Or should have a custom model (not using any qt model classes) and use that as the model for the GraphicsView. Then when there are changes made, signal them to the MoleculeModel(qtAbstractListModel) for the UI.
Second one seems easier.
-
I am building a 3d molecule editor.
I have a model MoleculeModel(qtAbstractListModel) of molecules to allow changes from the UI.
However, I am not sure how to go about building the 3d scene. I already have a class GraphicsView that derives from qt3dwindow.
The program allows moving molecules in 3d, breaking bonds, etc.
I plan on maintaining good programming standards.My question: Is it advisable to make GraphicsView also inherit from QAbstractItemView? Then override the functions.
Or should have a custom model (not using any qt model classes) and use that as the model for the GraphicsView. Then when there are changes made, signal them to the MoleculeModel(qtAbstractListModel) for the UI.
Second one seems easier.
What would you need a model for? The 3D scene boils down to a tree of nodes (entities and components), so I suppose the better question you should be asking is - "If I were to have a model for my molecule, what would it represent - expose to the supposed view".
In other words I don't see a reason why you'd want to have a model that represents a single molecule. Perhaps if you elaborate on why you think you may need it, we could explore that. Perhaps you would want to share a mock-up of your UI, which could be useful to determine what you actually need to implement as models/views. Generally speaking you'd want a model if you're going to use it with the model-view framework, other than that you don't.