Created
December 30, 2018 02:38
-
-
Save sazus/a9240f94f8cb1cdaa8a83354ce48813e to your computer and use it in GitHub Desktop.
Qt QML Simple Layout
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.12 | |
import QtQuick.Window 2.12 | |
import QtQuick.Controls 2.4 | |
import QtQuick.Layouts 1.3 | |
Window { | |
id: window_ | |
visible: true | |
visibility: Window.Maximized | |
title: qsTr("Title") | |
color: "gray" | |
ColumnLayout { | |
id: column_layout_ | |
width: window_.width / 1.15; | |
height: window_.height / 1.15 | |
// anchors set | |
anchors.horizontalCenter: parent.horizontalCenter | |
anchors.verticalCenter: parent.verticalCenter | |
// ----- Blue Table ----- | |
Rectangle { | |
id: table_ | |
width: column_layout_.width | |
height: column_layout_.height - row_layout_.height | |
anchors.horizontalCenter: parent.horizontalCenter | |
border.width: 10 | |
border.color: "white" | |
color: "royalblue" | |
} | |
// ----- Button Layout ----- | |
RowLayout { | |
id: row_layout_ | |
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | |
anchors.top: table_.bottom | |
anchors.horizontalCenter: parent.horizontalCenter | |
// ----- Button PAUSE ----- | |
Rectangle { | |
id: button_pause | |
width: 100; height: 30; radius: 5; border.width: 5; border.color: "lightblue" | |
Text { | |
text: qsTr("PAUSE") | |
anchors.horizontalCenter: parent.horizontalCenter | |
anchors.verticalCenter: parent.verticalCenter | |
} | |
} | |
// ----- Button START ----- | |
Rectangle { | |
id: button_start | |
width: 100; height: 30; radius: 5; border.width: 5; border.color: "lightblue" | |
Text { | |
text: qsTr("START") | |
anchors.horizontalCenter: parent.horizontalCenter | |
anchors.verticalCenter: parent.verticalCenter | |
} | |
} | |
// ----- Button STOP ----- | |
Rectangle { | |
id: button_stop | |
width: 100; height: 30; radius: 5; border.width: 5; border.color: "lightblue" | |
Text { | |
text: qsTr("STOP") | |
anchors.horizontalCenter: parent.horizontalCenter | |
anchors.verticalCenter: parent.verticalCenter | |
} | |
} | |
} /// RowLayout | |
} /// ColumnLayout | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment