×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    1

    Question [Qt QML] Questions regarding QML Performance

    Hi,

    In the page: http://doc.qt.nokia.com/latest/qdecl...rformance.html

    I’m not quite understand two points, would you please help me?

    1. Opaque Items
    Items hidden behind an opaque item incur a cost. If an item will be entirely obscured by an opaque item, set its opacity to 0. One common example of this is when a "details" page is shown over the main application view.

    Question: If an item is hidden completely behind an opaque item, in my understand no drawing effort would be paid, why still need to set the opacity to 0?

    2. Anchors vs. Binding
    It is more efficient to use anchors rather than bindings to position items relative to each other. Consider this use of bindings to position rect2 relative to rect1:
    Rectangle {
    id: rect1
    x: 20
    width: 200; height: 200
    }
    Rectange {
    id: rect2
    x: rect1.x
    y: rect1.y + rect1.height
    width: rect1.width - 20
    height: 200
    }
    This is achieved more efficiently using anchors:
    Rectangle {
    id: rect1
    x: 20
    width: 200; height: 200
    }
    Rectange {
    id: rect2
    height: 200
    anchors.left: rect1.left
    anchors.top: rect1.bottom
    anchors.right: rect1.right
    anchors.rightMargin: 20
    }

    Question: I can’t understand why using anchors is better than bindings, shouldn’t the performance would be better if the programmer already defined the x/y and/or other geometry data?

    Thank you.

  2. #2
    Registered User
    Join Date
    Feb 2011
    Posts
    3

    Re: [Qt QML] Questions regarding QML Performance

    2. About second question:
    That tip tell you that manually calculation of sizes and positions is more expensive, then if it makes QML processor. I think if you have fixed sizes and positions, scene will work faster than anchors )
    Last edited by semlanik; 2011-05-06 at 11:22.

Similar Threads

  1. Qml to C++
    By cristids in forum Qt
    Replies: 1
    Last Post: 2010-06-14, 15:58
  2. Nokia Qt Sdk 1 RC 1 - No QML Support
    By cristids in forum [Archived] Qt SDKs and Tools
    Replies: 2
    Last Post: 2010-06-11, 12:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×