Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. The Lounge
  4. How and where to start Qt5
Forum Updated to NodeBB v4.3 + New Features

How and where to start Qt5

Scheduled Pinned Locked Moved Solved The Lounge
59 Posts 8 Posters 37.0k Views 6 Watching
  • 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.
  • tomyT tomy

    Thank you.

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #24

    @tomy
    as final remark.
    this book
    http://www.bogotobogo.com/cplusplus/files/c-gui-programming-with-qt-4-2ndedition.pdf
    i found pretty ok when starting with qt.
    Its for qt4 but much of it still the same in Qt5.5.

    1 Reply Last reply
    1
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #25

      To develop for iOS and OS X you will indeed need to install Qt Creator on your Mac machine (be it virtual or not) but you will be using the same for both platform. Xcode is mandatory to develop for OS X and iOS. It provides the SDKs and emulators needed as well as the software stack needed to connect to your device and make your application available through the App Store.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by
        #26

        @mrjj said:

        @tomy
        as final remark.
        this book
        http://www.bogotobogo.com/cplusplus/files/c-gui-programming-with-qt-4-2ndedition.pdf
        i found pretty ok when starting with qt.
        Its for qt4 but much of it still the same in Qt5.5.

        I have that book but haven't read it still! I like to start straightly with Qt5. Anyway, thanks for your remarks :-)

        @SGaist said:

        To develop for iOS and OS X you will indeed need to install Qt Creator on your Mac machine (be it virtual or not) but you will be using the same for both platform. Xcode is mandatory to develop for OS X and iOS. It provides the SDKs and emulators needed as well as the software stack needed to connect to your device and make your application available through the App Store.

        Thanks, these are great info. Now I've VmWare workstation containing Win XP, Win 10, Linux(Ubuntu) and FreeBSD installed on my Win 7 machine. I'll add another virtual machine (the Mac OS) on it before starting developing iOS apps.
        Thanks. :-)

        1 Reply Last reply
        0
        • tomyT Offline
          tomyT Offline
          tomy
          wrote on last edited by tomy
          #27

          Hi guys,

          Along the way I chose for starting to learn Qt 5, I went to create a Qt Quick Application in here: http://doc.qt.io/qtcreator/qtcreator-transitions-example.html
          Now one of my problems is that I cannot find that (Export) button (said in item #11 of Creating the Main View section of the above link) in the navigator pane on my Qt creator IDE :-(
          Can anybody please help me?

          CharbyC 1 Reply Last reply
          0
          • tomyT tomy

            Hi guys,

            Along the way I chose for starting to learn Qt 5, I went to create a Qt Quick Application in here: http://doc.qt.io/qtcreator/qtcreator-transitions-example.html
            Now one of my problems is that I cannot find that (Export) button (said in item #11 of Creating the Main View section of the above link) in the navigator pane on my Qt creator IDE :-(
            Can anybody please help me?

            CharbyC Offline
            CharbyC Offline
            Charby
            wrote on last edited by
            #28

            @tomy This button is aside the "eye" button for each element listed in the navigator pane.
            In the example, in the bottom left, you will see the navigator panel. The panel contains Item which contains "Icon" and at the end of this "Icon" row you will find the toggle property export and toggle visibity controls.
            Hope this helps. If not just send me a screenshot and I will return it to you with a marking.

            1 Reply Last reply
            0
            • tomyT Offline
              tomyT Offline
              tomy
              wrote on last edited by tomy
              #29

              @Charby said:

              @tomy This button is aside the "eye" button for each element listed in the navigator pane.
              In the example, in the bottom left, you will see the navigator panel. The panel contains Item which contains "Icon" and at the end of this "Icon" row you will find the toggle property export and toggle visibity controls.
              Hope this helps. If not just send me a screenshot and I will return it to you with a marking.

              Thanks for the reply.
              I retried that application creation for 5 times from beginning to the end, but neither that export button appeared nor my code (the one below) is exactly like this (http://doc.qt.io/qtcreator/qtcreator-transitions-mainform-ui-qml.html) :-(
              I don't know how I can learn Qt from the documentation if I have those many problems at the first step! :-( Very disappointing.

              import QtQuick 2.5
              import QtQuick.Controls 1.4
              import QtQuick.Layouts 1.2

              Item {
              id: item1
              width: 640
              height: 480

              property alias button1: button1
              property alias button2: button2
              
              Image {
                  id: icon
                  x: 10
                  y: 20
                  source: "qt-logo.PNG"
              }
              
              Rectangle {
                  id: topLeftRect
                  width: 46
                  height: 55
                  color: "#00000000"
                  radius: 6
                  anchors.left: parent.left
                  anchors.leftMargin: 10
                  anchors.top: parent.top
                  anchors.topMargin: 20
                  border.color: "#808080"
                  
                  MouseArea {
                      id: mouseArea1
                      anchors.fill: parent
                  }
              }
              
              Rectangle {
                  id: middleRightRect
                  x: -9
                  y: -7
                  width: 46
                  height: 55
                  color: "#00000000"
                  radius: 6
                  anchors.right: parent.right
                  anchors.rightMargin: 10
                  anchors.horizontalCenter: parent.horizontalCenter
                  border.color: "#808080"
                  MouseArea {
                      id: mouseArea2
                      anchors.fill: parent
                  }
              }
              
              Rectangle {
                  id: bottomLeftRect
                  y: 1
                  width: 46
                  height: 55
                  color: "#00000000"
                  radius: 6
                  anchors.left: parent.left
                  anchors.leftMargin: 10
                  anchors.bottom: parent.bottom
                  anchors.bottomMargin: 20
                  border.color: "#808080"
                  MouseArea {
                      id: mouseArea3
                      anchors.fill: parent
                  }
              }
              

              }

              Apparently uploading images to the posts is not allowed so I uploaded my design page of the IDE of that code here: http://uploads.im/ip2hb.png

              JKSHJ 1 Reply Last reply
              0
              • tomyT tomy

                @Charby said:

                @tomy This button is aside the "eye" button for each element listed in the navigator pane.
                In the example, in the bottom left, you will see the navigator panel. The panel contains Item which contains "Icon" and at the end of this "Icon" row you will find the toggle property export and toggle visibity controls.
                Hope this helps. If not just send me a screenshot and I will return it to you with a marking.

                Thanks for the reply.
                I retried that application creation for 5 times from beginning to the end, but neither that export button appeared nor my code (the one below) is exactly like this (http://doc.qt.io/qtcreator/qtcreator-transitions-mainform-ui-qml.html) :-(
                I don't know how I can learn Qt from the documentation if I have those many problems at the first step! :-( Very disappointing.

                import QtQuick 2.5
                import QtQuick.Controls 1.4
                import QtQuick.Layouts 1.2

                Item {
                id: item1
                width: 640
                height: 480

                property alias button1: button1
                property alias button2: button2
                
                Image {
                    id: icon
                    x: 10
                    y: 20
                    source: "qt-logo.PNG"
                }
                
                Rectangle {
                    id: topLeftRect
                    width: 46
                    height: 55
                    color: "#00000000"
                    radius: 6
                    anchors.left: parent.left
                    anchors.leftMargin: 10
                    anchors.top: parent.top
                    anchors.topMargin: 20
                    border.color: "#808080"
                    
                    MouseArea {
                        id: mouseArea1
                        anchors.fill: parent
                    }
                }
                
                Rectangle {
                    id: middleRightRect
                    x: -9
                    y: -7
                    width: 46
                    height: 55
                    color: "#00000000"
                    radius: 6
                    anchors.right: parent.right
                    anchors.rightMargin: 10
                    anchors.horizontalCenter: parent.horizontalCenter
                    border.color: "#808080"
                    MouseArea {
                        id: mouseArea2
                        anchors.fill: parent
                    }
                }
                
                Rectangle {
                    id: bottomLeftRect
                    y: 1
                    width: 46
                    height: 55
                    color: "#00000000"
                    radius: 6
                    anchors.left: parent.left
                    anchors.leftMargin: 10
                    anchors.bottom: parent.bottom
                    anchors.bottomMargin: 20
                    border.color: "#808080"
                    MouseArea {
                        id: mouseArea3
                        anchors.fill: parent
                    }
                }
                

                }

                Apparently uploading images to the posts is not allowed so I uploaded my design page of the IDE of that code here: http://uploads.im/ip2hb.png

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on last edited by JKSH
                #30

                @tomy said:

                I uploaded my design page of the IDE of that code here: http://uploads.im/ip2hb.png

                The "Export" button is a new feature in Qt Creator 3.6. It looks like you are using Qt Creator 3.5 (which is the version that was bundled with Qt 5.5.1)

                If you want to use that tutorial as a starting point, you have 2 options:

                1. Use the older version of the documentation. In Qt Creator 3.5, click Help -> Index and search for "Creating a Qt Quick Application", OR
                2. Go to http://www.qt.io/download-open-source/ and download Qt Creator 3.6 (Note: This means you will have 2 copies of Qt Creator on your system)

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  eureka
                  wrote on last edited by
                  #31

                  As a rank beginner myself I'm following this thread with some interest.
                  Please view this post as beginner's notes to add to advice you receive from experts.

                  I had to jump through the same hoops in getting Qt 5.5.1 up and running.
                  Recently I started on my Qt 5+ learning curve by first installing the older version of Qt 4 from Ubuntu Software Centre. But I soon realised that I needed Qt 5.5.1.
                  So I uninstalled all older versions of Qt to avoid conflicts and started afresh.
                  It seems that you are on Windows 64 and previously you installed Qt 5.1.0.
                  My experiences are on Linux Ubuntu 14.04 32bit.
                  However I see that you have installed several OS virtual machines including Ubuntu so you could use Ubuntu VM to try the following Qt 5.5.1 installation workflow.

                  http://softmemos.blogspot.co.uk/2015/11/qt551-on-ubuntu-1404-at-virtualbox.html

                  Note: VirtualBox is similar to VMWare.

                  I followed just Step 2A: The easy way
                  and Qt 5.5.1 was installed successfully in directory /opt/qt55 (I didn't use /opt/qt5.5.1 as suggested).

                  More details here on Qt 5.5.1 PPA installation on Ubuntu ..
                  https://launchpad.net/~beineri/+archive/ubuntu/opt-qt551-trusty

                  After installation run terminal commands

                  qtchooser -print-env
                  and
                  qmake -v

                  Now since I wanted Python bindings and to use eric6 Python IDE I next installed PyQt5.
                  https://www.riverbankcomputing.com/software/pyqt/download5
                  Prerequisites .. qscintilla and eric6 installation advice found here ...
                  http://stackoverflow.com/questions/30730288/how-do-i-compile-qscintilla-and-eric6-on-linux

                  After all this I now have under Applications > Programming these launchers

                  eric6
                  Qt 5.5 Assistant
                  Qt 5.5 Creator (this is Qt Creator 3.6.0 based on Qt 5.5.1)
                  Qt 5.5 Designer
                  Qt 5.5 Linguist

                  I use Sublime Text 3 as my editor.

                  eric6 launches Qt 5.5 Designer from its IDE.
                  ...

                  Regarding getting into Qt 5.5.1 I refer to examples in Qt Creator to get an idea of the app layout.
                  Qt 5 + documentation does seem to be scattered around so it helps to keep notes.
                  I use CherryTree from http://www.giuspen.com/cherrytree/ as notes manager.
                  ...

                  This book can be added to your reading list.
                  https://qmlbook.github.io/

                  1 Reply Last reply
                  0
                  • tomyT Offline
                    tomyT Offline
                    tomy
                    wrote on last edited by tomy
                    #32

                    Thank you very much eureka for your comprehensive explanations. I want to firstly go for Qt on Windows. Some later time I may go for it on Linux. At that time I will follow and do your instructions carefully. :-)

                    Thank you JKSH.
                    I went for your link and the system is downloading it. But apparently this one is also Qt creator 5.5! Further more, I had tried downloading the Qt using that file before. And I had faced an error when downloading. The error at the time was: http://uploads.im/QXBsp.png
                    But this I hope it can be downloaded successfully.

                    If that version be downloaded, is it the most recent version (Qt creator 3.6) please?

                    JKSHJ 1 Reply Last reply
                    0
                    • tomyT tomy

                      Thank you very much eureka for your comprehensive explanations. I want to firstly go for Qt on Windows. Some later time I may go for it on Linux. At that time I will follow and do your instructions carefully. :-)

                      Thank you JKSH.
                      I went for your link and the system is downloading it. But apparently this one is also Qt creator 5.5! Further more, I had tried downloading the Qt using that file before. And I had faced an error when downloading. The error at the time was: http://uploads.im/QXBsp.png
                      But this I hope it can be downloaded successfully.

                      If that version be downloaded, is it the most recent version (Qt creator 3.6) please?

                      JKSHJ Offline
                      JKSHJ Offline
                      JKSH
                      Moderators
                      wrote on last edited by
                      #33

                      @tomy said:

                      I went for your link and the system is downloading it. But apparently this one is also Qt creator 5.5!

                      It is useful to know the difference between Qt and Qt Creator:

                      • Qt is the library. Qt contains the C++ classes that you can use in your app. The latest version is Qt 5.5.1.
                      • Qt Creator is the Integrated Development Environment (IDE). Qt Creator lets you manage multiple compilers and multiple versions of Qt. It also lets you write code and compile your app. The latest version is Qt Creator 3.6.0.

                      If you install Qt, it gives you the Qt library AND the Qt Creator IDE. However, Qt 5.5.1 only comes with Qt Creator 3.5.1.

                      If you install Qt Creator, you only get the IDE.

                      Right now, you already have Qt 5.5 and Qt Creator 3.5 in your system. You want to install Qt Creator 3.6, so you don't need to download Qt anymore.

                      Go to http://www.qt.io/download-open-source/ and click on "Qt Creator". Then, click on "Qt Creator 3.6.0 for Windows (80 MB)".

                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                      1 Reply Last reply
                      1
                      • JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #34

                        After you install Qt Creator 3.6.0, you need to do some setup, because does not know about the previous version that you installed:

                        1. See Adding Compilers to tell Qt Creator where to find your compiler.
                        2. See Adding Qt Versions to tell Qt Creator where to find the Qt binaries.
                        3. Finally, see Adding Kits to tell Qt Creator how to combine your compiler with the Qt binaries.

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        1 Reply Last reply
                        0
                        • E Offline
                          E Offline
                          eureka
                          wrote on last edited by
                          #35

                          @JKSH said:

                          However, Qt 5.5.1 only comes with Qt Creator 3.5.1.

                          I my Qt 5.5.1 installation (Ubuntu 14.04) when I click on Qt 5.5 Creator > Help
                          I see ... "Qt Creator 3.6.0
                          Based on Qt 5.5.1 (GCC 4.8.4, 32 bit)"

                          just to add to the confusion.

                          1 Reply Last reply
                          0
                          • E Offline
                            E Offline
                            eureka
                            wrote on last edited by
                            #36

                            @JKSH said:
                            Right now, you already have Qt 5.5 and Qt Creator 3.5 in your system.

                            But surely the version of Qt shown in this link refers to Qt 5.1.0 .. not Qt 5.5?
                            http://uploads.im/QXBsp.png
                            /qt5/qt.510.win64_msvc2012_64 ... etc

                            JKSHJ 1 Reply Last reply
                            0
                            • E eureka

                              @JKSH said:
                              Right now, you already have Qt 5.5 and Qt Creator 3.5 in your system.

                              But surely the version of Qt shown in this link refers to Qt 5.1.0 .. not Qt 5.5?
                              http://uploads.im/QXBsp.png
                              /qt5/qt.510.win64_msvc2012_64 ... etc

                              JKSHJ Offline
                              JKSHJ Offline
                              JKSH
                              Moderators
                              wrote on last edited by
                              #37

                              @eureka said:

                              @JKSH said:

                              However, Qt 5.5.1 only comes with Qt Creator 3.5.1.

                              I my Qt 5.5.1 installation (Ubuntu 14.04) when I click on Qt 5.5 Creator > Help
                              I see ... "Qt Creator 3.6.0
                              Based on Qt 5.5.1 (GCC 4.8.4, 32 bit)"

                              just to add to the confusion.

                              Did you use the Online installer? That lets you install multiple versions of Qt, and lets you upgrade Qt Creator to the latest version.

                              The Offline installer doesn't provide that. It only contains one fixed version of Qt and one fixed version of Qt Creator.

                              But surely the version of Qt shown in this link refers to Qt 5.1.0 .. not Qt 5.5?
                              http://uploads.im/QXBsp.png
                              /qt5/qt.510.win64_msvc2012_64 ... etc

                              Yes, that image shows an attempt to download Qt 5.1.0 via the Online installer.

                              But before that, @tomy already installed Qt 5.5.1 + Qt Creator 3.5.1 (using the Offline installer): https://forum.qt.io/topic/63499/how-and-where-to-start-qt5/21

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              1 Reply Last reply
                              0
                              • tomyT Offline
                                tomyT Offline
                                tomy
                                wrote on last edited by tomy
                                #38

                                @JKSH said:

                                After you install Qt Creator 3.6.0, you need to do some setup, because does not know about the previous version that you installed:

                                1. See Adding Compilers to tell Qt Creator where to find your compiler.
                                2. See Adding Qt Versions to tell Qt Creator where to find the Qt binaries.
                                3. Finally, see Adding Kits to tell Qt Creator how to combine your compiler with the Qt binaries.

                                Since I had the file qt-opensource-windows-x86-mingw492-5.5.1 (size = 997 MB) on my system so first I uninstalled it and tried to install Qt creator though the online method via that small file. And then when you said it's not needed to download/install Qt creator that way because I had it already, so I canceled the process and reinstalled the file above (997 MB) and then went for Qt Creator 3.6.0 for Windows (80 MB). Now I have two Qt creator icons on my desktop named Qt Creator 3.6.0 and Qt Creator (Community).
                                PS: When I installed the Qt creator (the 997 MB one) I selected all the options:
                                http://uploads.im/RuZQ9.png

                                Now the tasks I have done are:
                                For the #1 (Adding Compilers) whatever I could to do is in the link below:
                                http://uploads.im/5K23g.png
                                The Compiler path field and Platform codegen flags field are empty. I don't know the path of what file I should insert into those paths.

                                For the #2 (Adding Qt Versions) I did this: http://uploads.im/mgBTo.png
                                And for the #3 (Adding Kits) I did this: http://uploads.im/kufsC.png

                                Then I recreated the project and the Export icons appeared this time :-)
                                Isn't there any wrong done task in my works please?
                                And which one of the Qt creator apps should I use for my projects, Qt Creator 3.6.0 or Qt Creator (Community) from now on please?

                                JKSHJ 1 Reply Last reply
                                0
                                • tomyT tomy

                                  @JKSH said:

                                  After you install Qt Creator 3.6.0, you need to do some setup, because does not know about the previous version that you installed:

                                  1. See Adding Compilers to tell Qt Creator where to find your compiler.
                                  2. See Adding Qt Versions to tell Qt Creator where to find the Qt binaries.
                                  3. Finally, see Adding Kits to tell Qt Creator how to combine your compiler with the Qt binaries.

                                  Since I had the file qt-opensource-windows-x86-mingw492-5.5.1 (size = 997 MB) on my system so first I uninstalled it and tried to install Qt creator though the online method via that small file. And then when you said it's not needed to download/install Qt creator that way because I had it already, so I canceled the process and reinstalled the file above (997 MB) and then went for Qt Creator 3.6.0 for Windows (80 MB). Now I have two Qt creator icons on my desktop named Qt Creator 3.6.0 and Qt Creator (Community).
                                  PS: When I installed the Qt creator (the 997 MB one) I selected all the options:
                                  http://uploads.im/RuZQ9.png

                                  Now the tasks I have done are:
                                  For the #1 (Adding Compilers) whatever I could to do is in the link below:
                                  http://uploads.im/5K23g.png
                                  The Compiler path field and Platform codegen flags field are empty. I don't know the path of what file I should insert into those paths.

                                  For the #2 (Adding Qt Versions) I did this: http://uploads.im/mgBTo.png
                                  And for the #3 (Adding Kits) I did this: http://uploads.im/kufsC.png

                                  Then I recreated the project and the Export icons appeared this time :-)
                                  Isn't there any wrong done task in my works please?
                                  And which one of the Qt creator apps should I use for my projects, Qt Creator 3.6.0 or Qt Creator (Community) from now on please?

                                  JKSHJ Offline
                                  JKSHJ Offline
                                  JKSH
                                  Moderators
                                  wrote on last edited by
                                  #39

                                  @tomy said:

                                  Since I had the file qt-opensource-windows-x86-mingw492-5.5.1 (size = 997 MB) on my system so first I uninstalled it and tried to install Qt creator though the online method via that small file. And then when you said it's not needed to download/install Qt creator that way because I had it already, so I canceled the process and reinstalled the file above (997 MB) and then went for Qt Creator 3.6.0 for Windows (80 MB).

                                  That's fine.

                                  Now I have two Qt creator icons on my desktop named Qt Creator 3.6.0 and Qt Creator (Community).

                                  Yes, that's expected.

                                  The ideal way is to use the online installer. However, since you are experiencing errors, we won't use that. (There is a way to work around that error, but it involves lots of extra work)

                                  PS: When I installed the Qt creator (the 997 MB one) I selected all the options:
                                  http://uploads.im/RuZQ9.png

                                  That's fine.

                                  Now the tasks I have done are:
                                  For the #1 (Adding Compilers) whatever I could to do is in the link below:
                                  http://uploads.im/5K23g.png
                                  The Compiler path field and Platform codegen flags field are empty. I don't know the path of what file I should insert into those paths.

                                  For the #2 (Adding Qt Versions) I did this: http://uploads.im/mgBTo.png
                                  And for the #3 (Adding Kits) I did this: http://uploads.im/kufsC.png

                                  Isn't there any wrong done task in my works please?

                                  Everything looks good! I don't see anything wrong.

                                  And which one of the Qt creator apps should I use for my projects, Qt Creator 3.6.0 or Qt Creator (Community) from now on please?

                                  Use Qt Creator 3.6.0, since it has more features and bugfixes.

                                  (http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/dist/changes-3.6.0.md?h=3.6 shows you all the improvements that Qt Creator 3.6.0 has, compared to Qt Creator 3.5.1)

                                  Then I recreated the project and the Export icons appeared this time :-)

                                  Great! :)

                                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                  1 Reply Last reply
                                  1
                                  • tomyT Offline
                                    tomyT Offline
                                    tomy
                                    wrote on last edited by tomy
                                    #40

                                    Thank you very much dear JKSH.

                                    After finishing the design part. I went to the Adding Application Logic section of this attempt. And continued until #7 and pressed Ctrl+R to run the application.
                                    I got these from the Application Output window:

                                    *The program has unexpectedly finished.
                                    C:\Users\CS\Documents\build-test1-Desktop-Debug\debug\test1.exe crashed
                                    
                                    Starting C:\Users\CS\Documents\build-test1-Desktop-Debug\debug\test1.exe...
                                    QML debugging is enabled. Only use this in a safe environment.
                                    QQmlApplicationEngine failed to load component
                                    qrc:/main.qml:25 Type MainForm unavailable
                                    qrc:/MainForm.ui.qml:73 Syntax error
                                    
                                    The program has unexpectedly finished.
                                    C:\Users\CS\Documents\build-test1-Desktop-Debug\debug\test1.exe crashed
                                    
                                    Starting C:\Users\CS\Documents\build-test1-Desktop-Debug\debug\test1.exe...
                                    QML debugging is enabled. Only use this in a safe environment.
                                    QQmlApplicationEngine failed to load component
                                    qrc:/main.qml:25 Type MainForm unavailable
                                    qrc:/MainForm.ui.qml:73 Syntax error
                                    
                                    The program has unexpectedly finished.
                                    C:\Users\CS\Documents\build-test1-Desktop-Debug\debug\test1.exe crashed
                                    
                                    Starting C:\Users\CS\Documents\build-test1-Desktop-Debug\debug\test1.exe...
                                    QML debugging is enabled. Only use this in a safe environment.
                                    QQmlApplicationEngine failed to load component
                                    qrc:/main.qml:25 Type MainForm unavailable
                                    qrc:/MainForm.ui.qml:73 Syntax error
                                    
                                    The program has unexpectedly finished.
                                    C:\Users\CS\Documents\build-test1-Desktop-Debug\debug\test1.exe crashed
                                    Starting C:\Users\CS\Documents\build-test1-Desktop-Debug\debug\test1.exe...
                                    QML debugging is enabled. Only use this in a safe environment.
                                    QQmlApplicationEngine failed to load component
                                    qrc:/main.qml:25 Type MainForm unavailable
                                    qrc:/MainForm.ui.qml:12 Invalid alias reference. Unable to find id "mouseArea3"*
                                    

                                    And this is the code for my MainForm.ui.qml file:

                                    import QtQuick 2.5
                                    import QtQuick.Controls 1.4
                                    import QtQuick.Layouts 1.2
                                    
                                    Item {
                                        id: item1
                                        width: 640
                                        height: 480
                                        property alias bottomLeftRect: bottomLeftRect
                                        property alias topLeftRect: topLeftRect
                                        property alias icon: icon
                                        property alias mouseArea3: mouseArea3
                                        property alias mouseArea2: mouseArea2
                                        property alias middleRightRect: middleRightRect
                                        property alias mouseArea1: mouseArea1
                                    
                                        Image {
                                            id: icon
                                            x: 10
                                            y: 20
                                            source: "qt-logo.PNG"
                                        }
                                    
                                        Rectangle {
                                            id: topLeftRect
                                            width: 46
                                            height: 55
                                            color: "#808080"
                                            radius: 6
                                            anchors.left: parent.left
                                            anchors.leftMargin: 10
                                            anchors.top: icon.bottom
                                            anchors.topMargin: 20
                                    
                                            MouseArea {
                                                onClicked: stateGroup.state = ' '
                                            }
                                        }
                                    
                                        Rectangle {
                                            id: middleRightRect
                                            x: -4
                                            y: 9
                                            width: 46
                                            height: 55
                                            color: "#808080"
                                            radius: 6
                                            anchors.right: parent.right
                                            anchors.rightMargin: 10
                                            anchors.horizontalCenter: parent.horizontalCenter
                                            MouseArea {
                                                 onClicked: stateGroup.state = 'State1'
                                            }
                                        }
                                    
                                        Rectangle {
                                            id: bottomLeftRect
                                            x: -1
                                            y: -3
                                            width: 46
                                            height: 55
                                            color: "#808080"
                                            radius: 6
                                            anchors.bottom: parent.bottom
                                            anchors.bottomMargin: 20
                                            MouseArea {
                                               onClicked: stateGroup.state = 'State2'
                                            }
                                            anchors.left: parent.left
                                            anchors.leftMargin: 10
                                        }
                                        StateGroup {
                                               id: stateGroup
                                               states: [
                                                   State {
                                                       name: "State1"
                                    
                                                       PropertyChanges {
                                                           target: page.icon
                                                           x: page.middleRightRect.x
                                                           y: page.middleRightRect.y
                                                       }
                                                   },
                                                   State {
                                                       name: "State2"
                                    
                                                       PropertyChanges {
                                                           target: page.icon
                                                           x: page.bottomLeftRect.x
                                                           y: page.bottomLeftRect.y
                                                       }
                                                   }
                                               ]
                                        }
                                     }
                                    

                                    And this one is the code for my main.qml file:

                                    import QtQuick 2.5
                                    import QtQuick.Controls 1.4
                                    import QtQuick.Dialogs 1.2
                                    
                                    ApplicationWindow {
                                        visible: true
                                        title: qsTr("Transitions")
                                        width: 330
                                        height: 330
                                    
                                        menuBar: MenuBar {
                                            Menu {
                                                title: qsTr("File")
                                                MenuItem {
                                                    text: qsTr("&Open")
                                                    onTriggered: console.log("Open action triggered");
                                                }
                                                MenuItem {
                                                    text: qsTr("Exit")
                                                    onTriggered: Qt.quit();
                                                }
                                            }
                                        }
                                    
                                        MainForm {
                                            anchors.fill: parent
                                                    id: page
                                        }
                                    
                                        MessageDialog {
                                            id: messageDialog
                                            title: qsTr("May I have your attention, please?")
                                    
                                            function show(caption) {
                                                messageDialog.text = caption;
                                                messageDialog.open();
                                            }
                                        }
                                    }
                                    
                                    

                                    I tried to do my best according to the instructions given by that program, but I don't know how to solve the issues.
                                    Would you guys please help me?

                                    1 Reply Last reply
                                    0
                                    • JKSHJ Offline
                                      JKSHJ Offline
                                      JKSH
                                      Moderators
                                      wrote on last edited by
                                      #41

                                      @tomy said:

                                      qrc:/MainForm.ui.qml:12 Invalid alias reference. Unable to find id "mouseArea3"

                                      What happens if you delete the line, property alias mouseArea3: mouseArea3 ? (In fact, delete the lines for mouseArea1 and mouseArea2 too)

                                      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                      1 Reply Last reply
                                      1
                                      • tomyT Offline
                                        tomyT Offline
                                        tomy
                                        wrote on last edited by tomy
                                        #42

                                        Just as usual, your advice helped me. Thanks :-)

                                        It ran, but who was the faulty? Was it me? That is, as I said, I did my best when following the instructions (and most of the work is remained still), so why did I get that error?

                                        I asked this because my purpose is learning Qt and I need to write and run many many programs in Qt (as I have experienced it in C++ using the MS VS compiler) and I should learn them so that I be able to handle the errors for my programs.

                                        And there should be some way to get used to dealing with those codes. I have learnt using functions, pointers, references, exceptions, classes, templates and ... from C++ but the Qt codes don't seem to be much like C++!

                                        CharbyC JKSHJ 2 Replies Last reply
                                        0
                                        • tomyT tomy

                                          Just as usual, your advice helped me. Thanks :-)

                                          It ran, but who was the faulty? Was it me? That is, as I said, I did my best when following the instructions (and most of the work is remained still), so why did I get that error?

                                          I asked this because my purpose is learning Qt and I need to write and run many many programs in Qt (as I have experienced it in C++ using the MS VS compiler) and I should learn them so that I be able to handle the errors for my programs.

                                          And there should be some way to get used to dealing with those codes. I have learnt using functions, pointers, references, exceptions, classes, templates and ... from C++ but the Qt codes don't seem to be much like C++!

                                          CharbyC Offline
                                          CharbyC Offline
                                          Charby
                                          wrote on last edited by
                                          #43

                                          @tomy For what it worth, I have learnt QML without the editor, as I thing it help to have a better understanding of it. Furthermore the QML together with its declarative paradigm is so simple that I still never use the UI designer...Regarding your problem, it was clearly the property aliases pointing to not existing anymore elements...

                                          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