StackView
Our child views will be presented via aStackViewcomponent, which provides a stack-based navigation model with built-in history. New views (and views in this context means pretty much any QML) are pushed onto the stack when they are to be displayed and can be popped off the stack in order to go back to the previous view. We won’t need to use the history capabilities, but they are a very useful feature.
To gain access to the component, we first need to reference the module, so add the import to MasterView:
import QtQuick.Controls 2.2
With that done, let’s replace ourText element containing our welcome message with aStackView
:
StackView { id: contentFrame initialItem: "qrc:/views/SplashView.qml"}
We assign the component a unique identifier contentFrame
so that we can reference it elsewhere in the QML, and we specify which child view we want to load by default—the new SplashView
.
Next, editSplashView
. Update the QtQuick
module version to 2.9 so that it matches MasterView (do this for...