Bounding rectangle of rotated Item



  • How do you access the bounding rectangle of a rotated QML Item? For example in the code below how would I make the parent 'boundingRect' match the extents of the rotated child.

    @
    import QtQuick 2.1
    import QtQuick.Controls 1.0

    ApplicationWindow {
    id: mainWindow
    width: 300
    height: 300

    Rectangle {
    
        id: boundingRect
        x: 50
        y: 50
        color: 'yellow'
    
        width: childrenRect.width
        height: childrenRect.height
    
        Rectangle {
            id: rotated
            width: 75
            height: 100
            border.width: 1
            border.color: 'blue'
            rotation: 45
        }
    }
    

    }
    @

    Started to look at a solution using a width/height based on mapFromItem() but I don't think that's going to work as a general solution when I have multiple children which may be rotated and I want the bounding box of all of them.

    Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.