StatusBar is not a type
-
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.3ApplicationWindow {
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" } } }
}
-
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.3ApplicationWindow {
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" } } }
}
@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" } } } }
-
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.