Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.

accelBubble Tutorial



  • I have tried to start mobile development with the "Creating a Mobile Qt Application" Tutorial. I have installed Qt Creator 4.9.2 on Windows 10 (1903). I connected a Android Device (Wiko Pulp, Android 5.1) with my Computer and compiled the project (after solving a few problems - qmake.conf). When I execute the project, it is installed on my Android device. But the bubble does not move. In the "output of application" tab the is an error: "W/libaccelbubble.so(18015): qrc:/main.qml:115: ReferenceError: mainWindow is not defined"

    There is an example accelBubble also in the Qt 5.13.0 directory without pages. This examples runs without problems, but I want to understand, why the tutorial example does not work.


  • Moderators

    Hi @guestu, and welcome!

    @guestu said in accelBubble Tutorial:

    qrc:/main.qml:115: ReferenceError: mainWindow is not defined

    The error message tells you that Line #115 contains a reference to mainWindow, but this ID does not exist.

    It is like an undefined variable in C++.



  • @jksh
    Thank you,
    the problem I had, was that I didn't know how to announce the property "mainWindow" in the main.qml. With your answer I changed

              Page1Form {
                  bubble {
                      id: bubble
                      centerX: mainWindow.width / 2
                      centerY: mainWindow.height / 2
                      bubbleCenter: bubble.width / 2
                      x: bubble.centerX - bubble.bubbleCenter 
    ...
    

    to

              Page1Form {
                  mainWindow {
                    id: mainWindow
                  }
    
                  bubble {
                      id: bubble
                      centerX: mainWindow.width / 2
                      centerY: mainWindow.height / 2
                      bubbleCenter: bubble.width / 2
                      x: bubble.centerX - bubble.bubbleCenter
    ...
    

    Now the mainWindow is know and the application is running as expected.
    Thank you very much.


Log in to reply