Skip to content

Instantly share code, notes, and snippets.

@sazus
Created December 30, 2018 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sazus/a9240f94f8cb1cdaa8a83354ce48813e to your computer and use it in GitHub Desktop.
Save sazus/a9240f94f8cb1cdaa8a83354ce48813e to your computer and use it in GitHub Desktop.
Qt QML Simple Layout
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