Created
October 18, 2012 09:30
-
-
Save torarnv/3910706 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import QtQuick 2.0 | |
Item { | |
width: 400 | |
height: 200 | |
Row { | |
anchors.centerIn: parent | |
spacing: 50 | |
Rectangle { | |
width: 100 | |
height: 100 | |
color: "white" | |
border { | |
color: "red" | |
width: 1 | |
} | |
Image { | |
property int padding: 1 | |
anchors { | |
fill: parent | |
margins: parent.border.width + padding | |
} | |
source: "http://placekitten.com/g/" + width + "/" + height | |
} | |
} | |
Rectangle { | |
width: 100 | |
height: 100 | |
color: "white" | |
border { | |
color: "green" | |
width: 1 | |
} | |
Image { | |
property int padding: 1 | |
anchors { | |
fill: parent | |
// Manual margin adjustments make kittens sad :( | |
topMargin: parent.border.width + padding | |
leftMargin: parent.border.width + padding | |
rightMargin: parent.border.width + padding - 1 | |
bottomMargin: parent.border.width + padding - 1 | |
} | |
source: "http://placekitten.com/g/" + width + "/" + height | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment