[Interest] Getting started with QML

Mark Constable markc at renta.net
Thu Nov 24 12:46:51 CET 2011


On 2011-11-24 12:07 PM, Alex Strickland wrote:
> If I maximise a screen, is there a way to scale everything?
> Does my initial rectangle of 400x400 scale up to the screen
> pixels? Does x = 5 become 20 if, for arguments sake, my
> screen is 1600x1600.

Not automatically but you can do something like this...

import QtQuick 1.0

Rectangle {
  width: 128; height: 72
  focus: true
  Keys.onEscapePressed: Qt.quit()

  property real em: width / 8

  Rectangle {
    width: 7*em; height: 3*em
    anchors.centerIn: parent
    color: "red"

    Text {
      font.pixelSize: em
      text: "Esc to Quit"
      anchors.centerIn: parent
    }
  }
}




More information about the Interest mailing list