Results 1 to 4 of 4

Thread: Starting Qt quick using a book

  1. #1
    Join Date
    Jan 2016
    Posts
    76
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Starting Qt quick using a book

    Hi,
    Using this example, firstly, I created an "Application > Qt Quick application project".
    I didn't change the main.cpp and kept the Window part and entered the Rectangle section below that, as follows:

    Qt Code:
    1. ```
    2. import QtQuick 2.6
    3. import QtQuick.Window 2.2
    4.  
    5. Window {
    6. visible: true
    7. width: 640
    8. height: 480
    9. title: qsTr("Rec")
    10.  
    11. Rectangle {
    12. id: root
    13. x: 50; y: 10
    14. width: 120; height: 240
    15. color: "Blue"
    16.  
    17. Image {
    18. id: triangle
    19. x: root.width + width/2; y: height/2
    20. source: "/triangle_red.png"
    21. }
    22.  
    23. Text {
    24. y: 50
    25. width: root.width
    26. color: "white"
    27. horizontalAlignment: Text.AlignHCenter
    28. text: "Triangle"
    29. }
    30. }
    31. }
    32. ```
    To copy to clipboard, switch view to plain text mode 

    The output is shown for Desktop. For other kits I just pressed the build button because I just needed the APK files.

    My questions:

    1- Is the type of the project I created exactly the one the book has used?
    2-Do I need to keep the Window section? If so why isn't it shown in the example?
    3- Shouldn't I change anything in main.cpp?
    4- I built the project using the Arm Android kit but the size of the APK files for both Release and Debug modes are the same. I expected to have a smaller size for the Release mode.

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Starting Qt quick using a book

    Quote Originally Posted by franky View Post
    1- Is the type of the project I created exactly the one the book has used?
    No but if you want to get an APK then the project type you have chosen is the correct one.

    2-Do I need to keep the Window section? If so why isn't it shown in the example?
    No, you don't have to in general. But for the project implementation you have chosen it makes sense to start with a Window.

    3- Shouldn't I change anything in main.cpp?
    No.

    4- I built the project using the Arm Android kit but the size of the APK files for both Release and Debug modes are the same. I expected to have a smaller size for the Release mode.
    Your project has just a single cpp file (main.cpp) which is trivial so there is nothing to bloat your executable. For pure QML projects it doesn't have any practical effect to do a debug build.
    Last edited by wysota; 29th August 2017 at 09:24.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2016
    Posts
    76
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Starting Qt quick using a book

    No but if you want to get an APK then the project type you have chosen is the correct one.
    My question here is, how to create the project used in the example? I mean, what template/class to choose?

    And if I create a new project that way, won't I have APK files for the project?!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Starting Qt quick using a book

    My question here is, how to create the project used in the example? I mean, what template/class to choose?
    Other Projects -> QtQuick UI Prototype (or something similar).

    And if I create a new project that way, won't I have APK files for the project?!
    No, since you would be running the project on the desktop only. This type of project is not suitable for deployment on Android.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    franky (29th August 2017)

Similar Threads

  1. Replies: 2
    Last Post: 29th November 2016, 19:23
  2. Replies: 3
    Last Post: 5th July 2016, 17:13
  3. Qt Quick Book in Italian Language
    By paolosereno in forum Qt Quick
    Replies: 0
    Last Post: 17th August 2015, 18:10
  4. qt book
    By doss in forum Newbie
    Replies: 1
    Last Post: 8th April 2009, 10:24
  5. Choosing a qt4 book
    By asieriko in forum General Discussion
    Replies: 14
    Last Post: 7th October 2007, 15:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.