Qt 6.12 LTS is out! See what's new in the release
blog
StatusBar is not a type
-
Hello
I'm new to QML
just trying to do some simple tasks
here's the problem:
I have a main.qml file in which I am trying to connect an external unit called the StatusBar
The StatusBar is accordingly placed in a separate file and added to the resources
, but an error occurs when building the project. StatusBar is not a type
Please help!Here the code
main.qmlimport QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.12 Window { width: 1024 height: 680 visible: true title: qsTr("CoffeeSodaDispenserExample") StackView { id: stackView anchors.fill: parent initialItem: "qrc:/HotColdSelectionPage.qml" } StatusBar { id: statusB } }StatusBar.qml
import QtQuick 2.12 Item { Rectangle { id: statusBar color: "black" radius: 5 width: 780 height: 50 Rectangle { id: notificationBage width: 40 height: 40 radius: 20 color: "white" Text { id: badgeText text: qsTr("2") anchors.centerIn: parent font.pixelSize: 24 color: "black" } } Text { id: timeText text: qsTr("12:22 PM") anchors.centerIn: parent color: "white" font.pixelSize: 36 } Image { id: wifiSymbol source: "qrc:/UI/Assets/wifi.png" anchors { verticalCenter :parent.verticalCenter right: parent.right rightMargin: 10 } width: 40 height: 40 } } }Resource file
<RCC> <qresource prefix="/"> <file>UI/Assets/hot.png</file> <file>UI/Assets/previousCold.png</file> <file>UI/Assets/previousHot.png</file> <file>UI/Assets/resetCold.png</file> <file>UI/Assets/resetHot.png</file> <file>UI/Assets/snowflake.png</file> <file>UI/Assets/soda.png</file> <file>UI/Assets/softdrinks.png</file> <file>UI/Assets/tea.png</file> <file>UI/Assets/tickCold.png</file> <file>UI/Assets/tickHot.png</file> <file>UI/Assets/wifi.png</file> <file>HotColdSelectionPage.qml</file> <file>StatusBar.qml</file> </qresource> </RCC>