Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. I need an example for MVVM architecture, where the view is in QML and MODEL, VIEWMODEL in CPP. I want to understand how it works.
Forum Updated to NodeBB v4.3 + New Features

I need an example for MVVM architecture, where the view is in QML and MODEL, VIEWMODEL in CPP. I want to understand how it works.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 2.1k 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.
  • N Offline
    N Offline
    Nazeeruddin
    wrote on last edited by
    #1

    I am trying to understand MVVM architecture and I need a good example code so that I have a clear understanding of how the architecture actually works . Any kind of help will be greatly appreciated, Thank you in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      From the looks of it, you do not need MVVM using Qt Quick and C++ models. QtQuick already provides the binding part and does not require you to write business logic unless you want to.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      N 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        From the looks of it, you do not need MVVM using Qt Quick and C++ models. QtQuick already provides the binding part and does not require you to write business logic unless you want to.

        N Offline
        N Offline
        Nazeeruddin
        wrote on last edited by
        #3

        @SGaist hello, I have worked with model view architecture before and integrated CPP and QML and it worked fine, but I want to know how to develop the communication using MVVM architecture.

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          It is hard to give such an ready made example.
          Just give high level view

          1. ViewModel(C++ class) provides the data bindings directly to View(QML)
          2. Model may be simple c++ class, gets the data from appropriate sources & keeps it. This may or may not be Qt Model.
          3. ViewModel get the only required data from Model. It may apply filters or format it or convert & makes it presentable to view directly using the bindings.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          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