Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Problem with ApplicationWindow on QT Quick 2 Application



  • Hi everyone.
    I have problem trying to use ApplicationWindow.
    @import QtQuick 2.1
    import QtQuick.Controls 1.0
    import QtQuick.Window 2.0

    ApplicationWindow {
    title: qsTr("Hello World")
    width: 640
    height: 480

    menuBar: MenuBar {
        Menu {
            title: qsTr("File")
            MenuItem {
                text: qsTr("Exit")
                onTriggered: Qt.quit();
            }
        }
    }
    
    Button {
        text: qsTr("Hello World")
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
    }
    

    }@

    When i use Rectlange instead of ApplicationWindow then everythig is ok, but i need a ApplicationWindow for can adds convenience for positioning items.

    Thanks.



  • That is just the example code of application window. You need to specify exactly what your problem is. Remember that ApplicationWindow is not supported by QQuickView.



  • Thanks.

    What type of application i have to create to use ApplicationWindow and QtQuick.Controls 1.0 and can create C++ class or what class supported ApplicationWindow and QtQuick.Controls 1.0



  • It is listed on the overview page here:
    http://doc-snapshot.qt-project.org/qt5-stable/qtquickcontrols/qtquickcontrols-overview.html

    You have to use QmlApplicationEngine as the example shows



  • Thank you very much.
    Now it's work.


Log in to reply