Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. StatusBar is not a type
Forum Updated to NodeBB v4.3 + New Features

StatusBar is not a type

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 1.3k 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.
  • W Offline
    W Offline
    white
    wrote on last edited by
    #1

    I used the following code to learn qml development.
    but it will report 'StatusBar' is not a type when compiling.
    I am using the Qt 5.14.2 and compose file by qt creator.
    I have also read the qml document 5.14.2 and copy the example code of 'StatusBar' .

    Thanks for any comments.

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Window 2.12
    import QtQuick.Layouts 1.3

    ApplicationWindow {
    id: main
    visible: true
    width: 960 //640
    height: 640 //480
    visibility: "Maximized"
    title: qsTr("Hello world")

    menuBar: MenuBar {
        Menu {
            title: qsTr("test")
            MenuItem {
                text: qsTr("test1")
                Shortcut {
                    sequence: "Ctrl+N"
                }
            }
       }
    }
    
    header: ToolBar {
        
            ToolButton {
                text: qsTr("About")
    
            }
        
    }
    
    footer: StatusBar  {
         RowLayout {
             anchors.fill: parent
             Label { text: "Read Only" }
         }
    }
    

    }

    eyllanescE 1 Reply Last reply
    0
    • W white

      I used the following code to learn qml development.
      but it will report 'StatusBar' is not a type when compiling.
      I am using the Qt 5.14.2 and compose file by qt creator.
      I have also read the qml document 5.14.2 and copy the example code of 'StatusBar' .

      Thanks for any comments.

      import QtQuick 2.12
      import QtQuick.Controls 2.12
      import QtQuick.Window 2.12
      import QtQuick.Layouts 1.3

      ApplicationWindow {
      id: main
      visible: true
      width: 960 //640
      height: 640 //480
      visibility: "Maximized"
      title: qsTr("Hello world")

      menuBar: MenuBar {
          Menu {
              title: qsTr("test")
              MenuItem {
                  text: qsTr("test1")
                  Shortcut {
                      sequence: "Ctrl+N"
                  }
              }
         }
      }
      
      header: ToolBar {
          
              ToolButton {
                  text: qsTr("About")
      
              }
          
      }
      
      footer: StatusBar  {
           RowLayout {
               anchors.fill: parent
               Label { text: "Read Only" }
           }
      }
      

      }

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by
      #2

      @white StatusBar belongs to Qt Quick Control 1:

      import QtQuick 2.12
      import QtQuick.Controls 2.12
      import QtQuick.Layouts 1.3
      import QtQuick.Window 2.12
      import QtQuick.Controls 1.4 as QQC1
      
      ApplicationWindow {
          id: main
      
          visible: true
          width: 960 //640
          height: 640 //480
          visibility: "Maximized"
          title: qsTr("Hello world")
      
          menuBar: MenuBar {
              Menu {
                  title: qsTr("test")
      
                  MenuItem {
                      text: qsTr("test1")
      
                      Shortcut {
                          sequence: "Ctrl+N"
                      }
      
                  }
      
              }
      
          }
      
          header: ToolBar {
              ToolButton {
                  text: qsTr("About")
              }
      
          }
      
          footer: QQC1.StatusBar {
              RowLayout {
                  anchors.fill: parent
      
                  Label {
                      text: "Read Only"
                  }
      
              }
      
          }
      
      }
      

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      0
      • W Offline
        W Offline
        white
        wrote on last edited by
        #3

        Cool. I change the code according to your comments.
        the issue is gone/fixed. Thanks for your help.

        I thought when I imported the control version 2.12 "import QtQuick.Controls 2.12" , it should include all controls that come before this version.
        Now I realized I should import the exactly version number like what the document mentioned.

        In Android there is one concept like API level, It is convenience. I guess if implement the control like this will make development easier.

        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 Extensions
        • Unsolved