1. // File: BasicSteps_4.qml
  2. // NOTE: For the three images voringsfossen1.jpg, bergen.jpg and cotton_grass.jpg,
  3. //          you can take any image in JPEG format with the size 280x210 pixels.
  4. import Qt 4.7
  5.  
  6. Rectangle {
  7.     property int frameSize: 300
  8.     property int leftMargin: 10
  9.     property int topMargin: 25
  10.     property int bottomMargin: 65
  11.     property int fontSize: 20
  12.     property color frameColor: "#FFF8DC"    // cornsilk
  13.  
  14.     width: 3 * frameSize; height: frameSize
  15.  
  16.     // Photo 1
  17.     Rectangle {
  18.         x: 0; y: 0
  19.         width: frameSize; height: frameSize
  20.         color: frameColor
  21.  
  22.         Image {
  23.             x: leftMargin; y: topMargin
  24.             source: "voringsfossen1.jpg"
  25.         }
  26.  
  27.         Text {
  28.             x: 0; y: frameSize - bottomMargin
  29.             text: "Voringsfossen"
  30.             font.pixelSize: fontSize
  31.             width: frameSize; horizontalAlignment: Text.AlignHCenter
  32.             height: bottomMargin; verticalAlignment: Text.AlignVCenter
  33.         }
  34.     }
  35.  
  36.     // Photo 2
  37.     Rectangle {
  38.         x: frameSize; y: 0
  39.         width: frameSize; height: frameSize
  40.         color: frameColor
  41.  
  42.         Image {
  43.             x: leftMargin; y: topMargin
  44.             source: "bergen.jpg"
  45.         }
  46.  
  47.         Text {
  48.             x: 0; y: frameSize - bottomMargin
  49.             text: "Bergen"
  50.             font.pixelSize: fontSize
  51.             width: frameSize; horizontalAlignment: Text.AlignHCenter
  52.             height: bottomMargin; verticalAlignment: Text.AlignVCenter
  53.         }
  54.     }
  55.  
  56.     // Photo 3
  57.     Rectangle {
  58.         x: 2 * frameSize; y: 0
  59.         width: frameSize; height: frameSize
  60.         color: frameColor
  61.  
  62.         Image {
  63.             x: leftMargin; y: topMargin
  64.             source: "cotton_grass.jpg"
  65.         }
  66.  
  67.         Text {
  68.             x: 0; y: frameSize - bottomMargin
  69.             text: "Cotton Grass"
  70.             font.pixelSize: fontSize
  71.             width: frameSize; horizontalAlignment: Text.AlignHCenter
  72.             height: bottomMargin; verticalAlignment: Text.AlignVCenter
  73.         }
  74.     }
  75. }

Categories: