Visible area of an children Rectangle

  • Hello,

    i trying for hours now ^^ can u help me in my problem ?

    transleted in a simple application:
    @import QtQuick 1.1

    Rectangle {
    width: 360
    height: 360
    id: abc

    Rectangle {
        id: rect_red
        x: 68
        y: 35
        width: 200
        height: 200
        color: "#e21818"
        Rectangle {
            id: rect_blue
            x: 158
            y: 166
            width: 89
            height: 67
            color: "#2200ff"


    is it posible that only the top left corner of the blue rectangle is shown ? only the part of that Rectangle who is inside of the parent Rectangle ?

    I need it for a dynamic table in a Flickable Object. Cause The Table should be in the middle of an Application. And the Flickable can make every cell accessible.
    layers.sourcerect does not work : cause its unknow (perhapes i need to import something ? )

    I hope u understand all ^^

    thank you for your help :D

  • Hello and welcome to devnet,

    the only thing i could think of is to create a Border of Rectangles around the red rectangle which colors are the background-color and overlay the blue rectangle by using z: 2. --> No overlay over red, but blue is below it.

  • hi,
    thank you,
    i also thought about this method .. is there no smarter solution ?
    but if there is nothing else, then it seems i have to do it.

    Thank you

  • Hey,

    unfortunately i don't know of a better method, but i also had no need for that, yet. Maybe someone else can provide you a better method.

  • Hi,
    i did like u say it is okey, but i'll be happy for a better solution :D
    Thank you for help :D

  • You're welcome, i'm sure someone else knows a better method. :)

Log in to reply

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