Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can qt3d work with qt model/view programming?
Forum Updated to NodeBB v4.3 + New Features

Can qt3d work with qt model/view programming?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 170 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hamza Umair
    wrote on last edited by
    #1

    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.

    kshegunovK 1 Reply Last reply
    0
    • H Hamza Umair

      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.

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      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.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved