How to create a splash screen using QML
-
wrote on 15 Jul 2018, 19:55 last edited by
Hi, 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 really appreciated!
p.s. I am using QT 5.11.1 with QT Creator 4.6.2
-
Hi, 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 really appreciated!
p.s. I am using QT 5.11.1 with QT Creator 4.6.2
wrote on 16 Jul 2018, 04:11 last edited byHi, @startimeahmet
When I needed the same thing, I found these two resources very useful:
https://falsinsoft.blogspot.kr/2017/07/qml-show-android-native-splash-screen.html
-
Hi, 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 really appreciated!
p.s. I am using QT 5.11.1 with QT Creator 4.6.2
wrote on 16 Jul 2018, 05:07 last edited by@startimeahmet Here's an answer I gave someone on the forums... seemed to have worked for him:
https://forum.qt.io/topic/90954/proper-way-to-create-splash-screen-in-qt-quick2
1/3