Mastering MVC
Now that our solution structure is in place, we’ll get started on the MVC implementation. As you’ll see, it is very minimal and incredibly easy to set up.
First, expand cm-ui > Resources > views.qrc > / > views
, right-click on main.qml
, select Rename, and rename the file as
MasterView.qml
. If you get a message about project editing, just select Yes to continue anyway:

If you do get the error message, the file will still appear as main.qml
in the Projects pane, but the file will have been renamed in the filesystem.
Next, edit views.qrc
(right-click on it and select Open With > Plain Text Editor). Replace the content as follows:
<RCC> <qresource prefix="/views"> <file alias="MasterView.qml">views/MasterView.qml</file> </qresource> </RCC>
If you recall how we load this QML file in main.cpp
, the syntax is qrc:<prefix><filename>
. We previously had a /
prefix and a views/main.qml
relative filename. This gave...