author | sl |
Thu, 29 May 2014 14:27:08 +0200 | |
changeset 15 | 737f8bb110be |
parent 0 | c0e13d2503b9 |
child 16 | 35f01a0d460a |
permissions | -rw-r--r-- |
sl@0 | 1 |
import QtQuick 2.2 |
sl@0 | 2 |
import QtQuick.Controls 1.2 |
sl@15 | 3 |
import QtQuick.Window 2.1 |
sl@15 | 4 |
import MiniDisplay 1.0 |
sl@15 | 5 |
import QtQuick.Layouts 1.1 |
sl@15 | 6 |
|
sl@0 | 7 |
|
sl@0 | 8 |
Item { |
sl@15 | 9 |
//width: 100 |
sl@15 | 10 |
//height: 62 |
sl@0 | 11 |
//SystemPalette { id: palette } |
sl@0 | 12 |
clip: true |
sl@15 | 13 |
//anchors.fill:parent |
sl@0 | 14 |
|
sl@15 | 15 |
|
sl@15 | 16 |
|
sl@15 | 17 |
Window { |
sl@15 | 18 |
//parent: appWindow |
sl@15 | 19 |
id: splash |
sl@15 | 20 |
color: "transparent" |
sl@15 | 21 |
title: "Splash Window" |
sl@15 | 22 |
modality: Qt.NonModal |
sl@15 | 23 |
flags: Qt.SplashScreen |
sl@15 | 24 |
property int timeoutInterval: 41 |
sl@15 | 25 |
signal timeout |
sl@15 | 26 |
//! [splash-properties] |
sl@15 | 27 |
//! [screen-properties] |
sl@15 | 28 |
x: (Screen.width - rectangleScreen.width) / 2 |
sl@15 | 29 |
y: (Screen.height - rectangleScreen.height) / 2 |
sl@15 | 30 |
//! [screen-properties] |
sl@15 | 31 |
width: rectangleScreen.width |
sl@15 | 32 |
height: rectangleScreen.height |
sl@15 | 33 |
property int frameCounter:0; |
sl@15 | 34 |
property var startTime:new Date(); |
sl@15 | 35 |
|
sl@15 | 36 |
Rectangle { |
sl@15 | 37 |
id: rectangleScreen |
sl@15 | 38 |
anchors.centerIn: parent |
sl@15 | 39 |
width: 256 |
sl@15 | 40 |
height: 64 |
sl@15 | 41 |
color: "white" |
sl@15 | 42 |
border.width:1 |
sl@15 | 43 |
border.color: "black" |
sl@15 | 44 |
smooth: false |
sl@15 | 45 |
} |
sl@15 | 46 |
|
sl@15 | 47 |
ColumnLayout { |
sl@15 | 48 |
anchors.fill:parent |
sl@15 | 49 |
anchors.margins: 6 |
sl@15 | 50 |
spacing: 4 |
sl@15 | 51 |
|
sl@15 | 52 |
Label { |
sl@15 | 53 |
id: labelFrameCount |
sl@15 | 54 |
//anchors.centerIn: parent |
sl@15 | 55 |
text: "Frame Count" |
sl@15 | 56 |
antialiasing: false |
sl@15 | 57 |
} |
sl@15 | 58 |
|
sl@15 | 59 |
Label { |
sl@15 | 60 |
id: labelTime |
sl@15 | 61 |
//anchors.centerIn: parent |
sl@15 | 62 |
text: "Time" |
sl@15 | 63 |
antialiasing: false |
sl@15 | 64 |
} |
sl@15 | 65 |
|
sl@15 | 66 |
} |
sl@15 | 67 |
|
sl@15 | 68 |
|
sl@15 | 69 |
|
sl@15 | 70 |
|
sl@15 | 71 |
|
sl@15 | 72 |
//! [timer] |
sl@15 | 73 |
Timer { |
sl@15 | 74 |
interval: splash.timeoutInterval; running: true; repeat: true |
sl@15 | 75 |
onTriggered: { |
sl@15 | 76 |
//visible = false |
sl@15 | 77 |
|
sl@15 | 78 |
var current = new Date(); |
sl@15 | 79 |
var seconds = (current.getTime() - splash.startTime.getTime())/1000; |
sl@15 | 80 |
|
sl@15 | 81 |
splash.frameCounter++; |
sl@15 | 82 |
labelFrameCount.text=splash.frameCounter; |
sl@15 | 83 |
labelTime.text=seconds; |
sl@15 | 84 |
display.renderWindow(splash); |
sl@15 | 85 |
display.swapBuffers(); |
sl@15 | 86 |
splash.timeout() |
sl@15 | 87 |
} |
sl@15 | 88 |
} |
sl@15 | 89 |
//! [timer] |
sl@15 | 90 |
Component.onCompleted: { |
sl@15 | 91 |
visible = true |
sl@15 | 92 |
} |
sl@15 | 93 |
|
sl@15 | 94 |
} |
sl@15 | 95 |
|
sl@15 | 96 |
Column { |
sl@15 | 97 |
anchors.fill: parent |
sl@15 | 98 |
anchors.margins: 8 |
sl@15 | 99 |
spacing: 8 |
sl@15 | 100 |
|
sl@15 | 101 |
Button { |
sl@15 | 102 |
text: qsTr("Render Window") |
sl@15 | 103 |
onClicked: { |
sl@15 | 104 |
display.renderWindow(splash); |
sl@15 | 105 |
display.swapBuffers(); |
sl@15 | 106 |
} |
sl@15 | 107 |
} |
sl@15 | 108 |
} |
sl@0 | 109 |
} |