I am trying to develop an android application using QT. I want to show a splash screen at the start of the application. Splash screen will stay there for 2 seconds then main page of the app will be shown. For this I have created 2 .qml files.
Splash.qml
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Window 2.3
Window {
id: window
visible: true
width: Screen.width
height: Screen.height
signal timeout
Image {
id: image
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
width: 300
height: 300
source: "qrc:/../Desktop/photo_2018-03-21_19-53-06.jpg"
}
Text {
id: text1
y: image.height + image.y + 20
text: qsTr("@startimeahmet Presents")
anchors.horizontalCenter: parent.horizontalCenter
font.pixelSize: 25
}
Timer {
interval: 2000; running: true; repeat: false
onTriggered: {
visible = false
window.timeout()
}
}
}
main.qml
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Window 2.3
ApplicationWindow {
id: root
visible: false
width: Screen.width
height: Screen.height
Splash {
onTimeout: root.visible = true
}
}
But this doesn't work. Any help on this is appreciated.
p.s. I am using QT 5.11.1 with QT Creator 4.6.2