Results 1 to 2 of 2

Thread: Qt Quick output is displaying incorrectly after compile

  1. #1
    Join Date
    Jun 2015
    Posts
    5
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows Android

    Question Qt Quick output is displaying incorrectly after compile

    I designed a form in Qt Quick and compiled it for Android. When executed on simulated Android device the form appears completely different!

    I aligned the components to each other but nothing changed! (All items are in a Rectangle)

    This is what I designed:



    And this is what I've got:



    This is the QML:

    Qt Code:
    1. import QtQuick 2.2
    2. import QtQuick.Controls 1.1
    3.  
    4. ApplicationWindow {
    5. id: applicationWindow1
    6. visible: true
    7. width: 640
    8. height: 480
    9. title: qsTr("Hello World")
    10.  
    11. menuBar: MenuBar {
    12. Menu {
    13. title: qsTr("File")
    14. MenuItem {
    15. text: qsTr("Exit")
    16. onTriggered: Qt.quit();
    17. }
    18. }
    19. }
    20.  
    21. Rectangle {
    22. id: rectangle1
    23. x: -273
    24. y: 145
    25. width: 223
    26. height: 128
    27. color: "#ffffff"
    28. anchors.verticalCenter: parent.verticalCenter
    29. anchors.horizontalCenter: parent.horizontalCenter
    30.  
    31. TextField {
    32. id: textField1
    33. y: 18
    34. text: qsTr("")
    35. anchors.left: parent.left
    36. anchors.leftMargin: 16
    37. placeholderText: qsTr("نام کاربری")
    38. }
    39.  
    40. Label {
    41. id: label1
    42. y: 25
    43. text: qsTr("نام کاربری")
    44. anchors.left: textField1.right
    45. anchors.leftMargin: 19
    46. }
    47.  
    48. TextField {
    49. id: textField2
    50. y: 57
    51. width: 127
    52. height: 20
    53. text: qsTr("")
    54. anchors.left: parent.left
    55. anchors.leftMargin: 16
    56. placeholderText: qsTr("کلمه عبور")
    57. }
    58.  
    59. Label {
    60. id: label2
    61. y: 64
    62. text: qsTr("نام کاربری")
    63. anchors.left: textField2.right
    64. anchors.leftMargin: 19
    65. }
    66.  
    67. Button {
    68. id: button1
    69. x: 74
    70. width: 75
    71. height: 23
    72. text: qsTr("ورود")
    73. anchors.top: textField2.bottom
    74. anchors.topMargin: 20
    75. }
    76. }
    77. }
    To copy to clipboard, switch view to plain text mode 

  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: Qt Quick output is displaying incorrectly after compile

    You can clearly see the font size is different. Thus if you don't anchor elements in a way that they will push other elements apart when more space is required, you will not get a proper layout. It is unadvised to provide absolute values for all of x and y as well as width and height of your elements unless you really know what you are doing.
    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. The following user says thank you to wysota for this useful post:

    rostamiani (7th June 2015)

Similar Threads

  1. Replies: 3
    Last Post: 5th July 2016, 16:13
  2. Replies: 3
    Last Post: 24th August 2011, 13:47
  3. Extra newlines in compile output window
    By Mookie in forum Qt Tools
    Replies: 0
    Last Post: 3rd November 2010, 20:29
  4. Strange output: Can't compile for WinCE to save my life!
    By codeslicer in forum Qt Programming
    Replies: 3
    Last Post: 20th February 2010, 14:55
  5. QProcess problem: compile well but output error
    By jx324 in forum Qt Programming
    Replies: 3
    Last Post: 2nd March 2008, 07:39

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.