Results 1 to 2 of 2

Thread: Is this a bug or I'm doing it wrong? (resizing an item when resizing a window)

  1. #1
    Join Date
    Mar 2011
    Posts
    29
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Is this a bug or I'm doing it wrong? (resizing an item when resizing a window)

    Edit: I've missed to mention that I am using Qt 5.2

    Here is the qml file from the OpenGL under Qml example:

    Qt Code:
    1. //! [1]
    2. import QtQuick 2.0
    3. import OpenGLUnderQML 1.0
    4.  
    5. Item {
    6. id: rectangle1
    7. width: 320
    8. height: 480
    9.  
    10. Squircle {
    11. SequentialAnimation on t {
    12. NumberAnimation { to: 1; duration: 2500; easing.type: Easing.InQuad }
    13. NumberAnimation { to: 0; duration: 2500; easing.type: Easing.OutQuad }
    14. loops: Animation.Infinite
    15. running: true
    16. }
    17. }
    18. //! [1]
    19. //! [2]
    20. Rectangle {
    21. y: 0
    22. height: 80
    23. color: Qt.rgba(1, 1, 1, 0.7)
    24. radius: 10
    25. anchors.left: parent.left
    26. anchors.leftMargin: 10
    27. anchors.right: parent.right
    28. anchors.rightMargin: 10
    29. anchors.bottom: parent.bottom
    30. anchors.bottomMargin: 10
    31. border.width: 1
    32. }
    33. }
    34. //! [2]
    To copy to clipboard, switch view to plain text mode 

    And here is the same with a default hello world project:

    Qt Code:
    1. import QtQuick 2.0
    2.  
    3. Item {
    4. id: rectangle2
    5. width: 360
    6. height: 360
    7. Text {
    8. text: qsTr("Hello World")
    9. anchors.centerIn: parent
    10. }
    11. MouseArea {
    12. id: mouseArea1
    13. anchors.fill: parent
    14. onClicked: {
    15. Qt.quit();
    16. }
    17. }
    18.  
    19. Rectangle {
    20. id: rectangle1
    21. y: 235
    22. height: 97
    23. color: "#da8686"
    24. anchors.bottom: parent.bottom
    25. anchors.bottomMargin: 10
    26. anchors.right: parent.right
    27. anchors.rightMargin: 10
    28. anchors.left: parent.left
    29. anchors.leftMargin: 10
    30. }
    31. }
    To copy to clipboard, switch view to plain text mode 

    And I'm attaching a screenshot too. The former doesn't work and I don't see any problem in the code. BTW. I am using the MinGW distribution.


    I think there is a problem with anchors with this particular example (OpenGL under QML) and maybe that's a related issue.
    The idea is to make a rectangle that re-sizes with the window.

    If its not my oversight then I guess I should report a bug. I'm waiting for your opinions.

    Please see the screenshot about the actual result:
    Attached Images Attached Images
    Last edited by Zingam; 12th December 2013 at 12:34.

  2. #2
    Join Date
    Mar 2011
    Posts
    29
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is this a bug or I'm doing it wrong? (resizing an item when resizing a window)

    I guess it is an omission in the sample. This line is missing:
    Qt Code:
    1. view.setResizeMode(QQuickView::SizeRootObjectToView);
    To copy to clipboard, switch view to plain text mode 
    Which is present in other samples like: "Scene Graph - Rendering FBOs"

Similar Threads

  1. I`m doing it wrong....
    By KillGabio in forum Newbie
    Replies: 13
    Last Post: 13th February 2012, 01:58
  2. What am I doing wrong??
    By Splatify in forum Newbie
    Replies: 3
    Last Post: 7th February 2011, 16:47
  3. What do I do wrong
    By Arif Bilgin in forum Newbie
    Replies: 12
    Last Post: 20th October 2010, 20:03
  4. i don't know what i do wrong..
    By Hardstyle in forum Newbie
    Replies: 2
    Last Post: 27th June 2010, 17:33
  5. What's wrong??
    By dreamer in forum Qt Programming
    Replies: 2
    Last Post: 25th June 2008, 08:07

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.