Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.1
- import QtQuick.Controls 1.0
- import QtQuick.Window 2.0
- ApplicationWindow {
- title: "qml"
- width: 640
- height: 480
- Rectangle {
- anchors.fill: parent
- color: Qt.rgba(0, 0, 0, 0.5);
- Rectangle {
- color: "#4fa46b"
- height: parent.height/2
- width: parent.width/2
- anchors.centerIn: parent
- border.width: 5
- border.color: "#2e5f3e"
- ScrollView {
- id: scroll
- anchors.fill: parent
- anchors.margins: 24
- Column {
- spacing: 20
- Text {
- color: 'white'
- text: 'Absolute Center.'
- width: scroll.width
- wrapMode: Text.WordWrap
- font {
- pointSize: 22
- bold: true
- }
- }
- Text {
- color: 'white'
- text: 'This box is absolutely centered within the viewport, horizontally and vertically, using only QML.'
- width: scroll.width
- wrapMode: Text.WordWrap
- font.pointSize: 12
- }
- Text {
- color: 'white'
- text: 'Click me to learn more.'
- width: scroll.width
- wrapMode: Text.WordWrap
- font.pointSize: 12
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment