BasicSteps 4: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(Cleanup)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Developing_with_Qt::Qt Quick::Tutorial]]
[[Category:Developing_with_Qt::Qt Quick::Tutorial]]
<code>
<code>
// File: BasicSteps_4.qml
// NOTE: For the three images voringsfossen1.jpg, bergen.jpg and cotton_grass.jpg,
// you can take any image in JPEG format with the size 280x210 pixels.
import Qt 4.7


// File: BasicSteps_4.qml<br />// NOTE: For the three images voringsfossen1.jpg, bergen.jpg and cotton_grass.jpg,<br />// you can take any image in JPEG format with the size 280x210 pixels.<br />import Qt 4.7
Rectangle {
 
property int frameSize: 300
Rectangle {<br /> property int frameSize: 300<br /> property int leftMargin: 10<br /> property int topMargin: 25<br /> property int bottomMargin: 65<br /> property int fontSize: 20<br /> property color frameColor: &quot;#FFF8DC&amp;quot; // cornsilk
property int leftMargin: 10
property int topMargin: 25
property int bottomMargin: 65
property int fontSize: 20
property color frameColor: "#FFF8DC" // cornsilk


width: 3 * frameSize; height: frameSize
width: 3 * frameSize; height: frameSize


// Photo 1<br /> Rectangle {<br /> x: 0; y: 0<br /> width: frameSize; height: frameSize<br /> color: frameColor
// Photo 1
 
Rectangle {
Image {<br /> x: leftMargin; y: topMargin<br /> source: &quot;voringsfossen1.jpg&amp;quot;<br /> }
x: 0; y: 0
width: frameSize; height: frameSize
color: frameColor


Text {<br /> x: 0; y: frameSize - bottomMargin<br /> text: &quot;Voringsfossen&amp;quot;<br /> font.pixelSize: fontSize<br /> width: frameSize; horizontalAlignment: Text.AlignHCenter<br /> height: bottomMargin; verticalAlignment: Text.AlignVCenter<br /> }<br /> }
Image {
x: leftMargin; y: topMargin
source: "voringsfossen1.jpg"
}


// Photo 2<br /> Rectangle {<br /> x: frameSize; y: 0<br /> width: frameSize; height: frameSize<br /> color: frameColor
Text {
x: 0; y: frameSize - bottomMargin
text: "Voringsfossen"
font.pixelSize: fontSize
width: frameSize; horizontalAlignment: Text.AlignHCenter
height: bottomMargin; verticalAlignment: Text.AlignVCenter
}
}


Image {<br /> x: leftMargin; y: topMargin<br /> source: &quot;bergen.jpg&amp;quot;<br /> }
// Photo 2
Rectangle {
x: frameSize; y: 0
width: frameSize; height: frameSize
color: frameColor


Text {<br /> x: 0; y: frameSize - bottomMargin<br /> text: &quot;Bergen&amp;quot;<br /> font.pixelSize: fontSize<br /> width: frameSize; horizontalAlignment: Text.AlignHCenter<br /> height: bottomMargin; verticalAlignment: Text.AlignVCenter<br /> }<br /> }
Image {
x: leftMargin; y: topMargin
source: "bergen.jpg"
}


// Photo 3<br /> Rectangle {<br /> x: 2 * frameSize; y: 0<br /> width: frameSize; height: frameSize<br /> color: frameColor
Text {
x: 0; y: frameSize - bottomMargin
text: "Bergen"
font.pixelSize: fontSize
width: frameSize; horizontalAlignment: Text.AlignHCenter
height: bottomMargin; verticalAlignment: Text.AlignVCenter
}
}


Image {<br /> x: leftMargin; y: topMargin<br /> source: &quot;cotton_grass.jpg&amp;quot;<br /> }
// Photo 3
Rectangle {
x: 2 * frameSize; y: 0
width: frameSize; height: frameSize
color: frameColor


Text {<br /> x: 0; y: frameSize - bottomMargin<br /> text: &quot;Cotton Grass&amp;quot;<br /> font.pixelSize: fontSize<br /> width: frameSize; horizontalAlignment: Text.AlignHCenter<br /> height: bottomMargin; verticalAlignment: Text.AlignVCenter<br /> }<br /> }<br />}
Image {
x: leftMargin; y: topMargin
source: "cotton_grass.jpg"
}


Text {
x: 0; y: frameSize - bottomMargin
text: "Cotton Grass"
font.pixelSize: fontSize
width: frameSize; horizontalAlignment: Text.AlignHCenter
height: bottomMargin; verticalAlignment: Text.AlignVCenter
}
}
}
</code>
</code>

Latest revision as of 11:40, 28 June 2015

// File: BasicSteps_4.qml
// NOTE: For the three images voringsfossen1.jpg, bergen.jpg and cotton_grass.jpg,
// you can take any image in JPEG format with the size 280x210 pixels.
import Qt 4.7

Rectangle {
 property int frameSize: 300
 property int leftMargin: 10
 property int topMargin: 25
 property int bottomMargin: 65
 property int fontSize: 20
 property color frameColor: "#FFF8DC" // cornsilk

width: 3 * frameSize; height: frameSize

// Photo 1
 Rectangle {
 x: 0; y: 0
 width: frameSize; height: frameSize
 color: frameColor

Image {
 x: leftMargin; y: topMargin
 source: "voringsfossen1.jpg"
 }

Text {
 x: 0; y: frameSize - bottomMargin
 text: "Voringsfossen"
 font.pixelSize: fontSize
 width: frameSize; horizontalAlignment: Text.AlignHCenter
 height: bottomMargin; verticalAlignment: Text.AlignVCenter
 }
 }

// Photo 2
 Rectangle {
 x: frameSize; y: 0
 width: frameSize; height: frameSize
 color: frameColor

Image {
 x: leftMargin; y: topMargin
 source: "bergen.jpg"
 }

Text {
 x: 0; y: frameSize - bottomMargin
 text: "Bergen"
 font.pixelSize: fontSize
 width: frameSize; horizontalAlignment: Text.AlignHCenter
 height: bottomMargin; verticalAlignment: Text.AlignVCenter
 }
 }

// Photo 3
 Rectangle {
 x: 2 * frameSize; y: 0
 width: frameSize; height: frameSize
 color: frameColor

Image {
 x: leftMargin; y: topMargin
 source: "cotton_grass.jpg"
 }

Text {
 x: 0; y: frameSize - bottomMargin
 text: "Cotton Grass"
 font.pixelSize: fontSize
 width: frameSize; horizontalAlignment: Text.AlignHCenter
 height: bottomMargin; verticalAlignment: Text.AlignVCenter
 }
 }
}