qmlFrontend/qml/qmlFrontend/main.qml
author unc0rr
Fri, 26 Sep 2014 00:56:36 +0400
branchqmlfrontend
changeset 10422 4cf23d4c7624
parent 10420 02c573d19224
child 10896 5a74923120d5
permissions -rw-r--r--
- Pages - Animations on buttons hovering

import QtQuick 2.0

Rectangle {
    id: pages
    width: 800
    height: 600

    property variant pagesList  : [
        "First"
        , "LocalGame"
        , "GameConfig"
    ];

    property string  currentPage : "First";

    Repeater {
        model: pagesList;

        delegate: Loader {
            active: false
            asynchronous: true
            anchors.fill: parent
            visible: (currentPage === modelData)
            source: "%1.qml".arg(modelData)
            onVisibleChanged:      loadIfNotLoaded();
            Component.onCompleted: loadIfNotLoaded();

            function loadIfNotLoaded ()
            {
                if (visible && !active)
                    active = true;
            }
        }
    }
}