Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. StatusBar is not a type
Qt 6.12 LTS is out! See what's new in the release blog

StatusBar is not a type

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 459 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AleksE
    wrote on last edited by AleksE
    #1

    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.qml

    import 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>
    
    
    1 Reply Last reply
    0
    • A Offline
      A Offline
      AleksE
      wrote on last edited by
      #2

      As I found this problem only in Qt 6.2
      when I select the minimum required version of QT 5.x - everything works.
      Obviously, in 6.2, the order of registration of components has somehow changed
      Who knows how to fix it or do it right ?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved