Skip to content

Instantly share code, notes, and snippets.

@sazus

sazus/Main.qml

Created Dec 30, 2018
Embed
What would you like to do?
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
You can’t perform that action at this time.