main.qml
author sl
Wed, 28 May 2014 10:20:32 +0200
changeset 7 b3cce7791326
parent 5 62a1d3631dcb
child 8 9543e1703afb
permissions -rw-r--r--
Async loading of our tabs.
Displaying progress bar during tab loading.
     1 import QtQuick 2.2
     2 import QtQuick.Controls 1.2
     3 import QtPositioning 5.3
     4 import QtWinExtras 1.0
     5 import QtQuick.Dialogs 1.2
     6 import QtQuick.Window 2.1
     7 import Qt.labs.settings 1.0
     8 import MiniDisplay 1.0
     9 
    10 
    11 
    12 ApplicationWindow {
    13     id: appWindow
    14     visible: true
    15     width: 640
    16     height: 480
    17     title: qsTr("MiniDisplay Manager")
    18     SystemPalette { id: palette }
    19     //Component.onCompleted: progressBar.visible=tabViewMain.getTab(tabViewMain.currentIndex).status !== Loader.Ready
    20 
    21     Settings {
    22         property alias x: appWindow.x
    23         property alias y: appWindow.y
    24         property alias width: appWindow.width
    25         property alias height: appWindow.height
    26     }
    27 
    28     /*
    29     menuBar: MenuBar {
    30         Menu {
    31             title: qsTr("File")
    32             MenuItem {
    33                 text: qsTr("Exit")
    34                 onTriggered: Qt.quit();
    35             }
    36         }
    37 
    38     }*/
    39 
    40     function trackProgress()
    41     {
    42         progressBar.value = tabViewMain.getTab(tabViewMain.currentIndex).progress;
    43         progressBar.visible = tabViewMain.getTab(tabViewMain.currentIndex).status !== Loader.Ready;
    44     }
    45 
    46     MiniDisplay {
    47         id: display
    48         onOpened:{ textDisplayStatus.text=qsTr("Connected");}
    49         onClosed:textDisplayStatus.text=qsTr("Disconnected")
    50         onOpenError:{ textDisplayStatus.text=qsTr("Connection error");}
    51     }
    52 
    53 
    54     TabView {
    55         id:tabViewMain
    56         anchors.fill: parent
    57         anchors.margins: 8
    58         visible: true
    59 
    60         Tab {
    61             //id:tabDisplay
    62             title: qsTr("Display")
    63             asynchronous: true
    64             //onLoaded: progressBar.visible=false
    65             onStatusChanged: trackProgress()
    66             DisplayTab { anchors.fill: parent }
    67         }
    68         Tab {
    69             //id:tabFont
    70             title: qsTr("Fonts")
    71             asynchronous: true
    72             onStatusChanged: trackProgress()
    73             FontsTab { anchors.fill: parent }
    74         }
    75         Tab {
    76             title: qsTr("Tests")
    77             asynchronous: true
    78             onStatusChanged: trackProgress()
    79             TestsTab { anchors.fill: parent }
    80         }
    81     } //TabView
    82 
    83     ProgressBar {
    84         id: progressBar
    85         anchors.centerIn: parent
    86     }
    87 
    88 
    89 }