go boilerplate code and initial qml interface
This commit is contained in:
parent
db4f8e1d61
commit
f7f8ff2c57
25
main.go
25
main.go
@ -3,8 +3,31 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/kardianos/osext"
|
||||
"gopkg.in/qml.v1"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello World!")
|
||||
if err := qml.Run(run); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func run() error {
|
||||
engine := qml.NewEngine()
|
||||
path, err := osext.ExecutableFolder()
|
||||
controls, err := engine.LoadFile(path + "/../share/main.qml")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
window := controls.CreateWindow(nil)
|
||||
window.ObjectByName("data1")
|
||||
|
||||
window.Show()
|
||||
window.Wait()
|
||||
return nil
|
||||
}
|
||||
|
104
main.qml
104
main.qml
@ -2,35 +2,97 @@ import QtQuick 2.5
|
||||
import QtQuick.Controls 1.3
|
||||
|
||||
ApplicationWindow {
|
||||
id: applicationWindow1
|
||||
title: "Presentation App"
|
||||
visible: true
|
||||
objectName: qsTr("")
|
||||
objectName: "applicationWindow1"
|
||||
minimumWidth: 500
|
||||
minimumHeight: 500
|
||||
property int globalForJs: 10
|
||||
SplitView {
|
||||
id: mainSlider
|
||||
objectName: "mainSlider"
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottomMargin: 0
|
||||
anchors.leftMargin: 0
|
||||
anchors.topMargin: 0
|
||||
orientation: Qt.Horizontal
|
||||
onResizingChanged: col1.width = gridData.width / 2
|
||||
|
||||
Grid {
|
||||
id: grid1
|
||||
x: 155
|
||||
y: 157
|
||||
width: 142
|
||||
height: 143
|
||||
clip: false
|
||||
columns: 2
|
||||
antialiasing: true
|
||||
z: 0
|
||||
rotation: 0
|
||||
scale: 1
|
||||
transformOrigin: Item.Center
|
||||
Column {
|
||||
TextArea {
|
||||
text: "test"
|
||||
Rectangle {
|
||||
id: gridRect
|
||||
objectName: "gridRect"
|
||||
width: 300
|
||||
color: "#00000000"
|
||||
radius: 1
|
||||
border.color: "#000000"
|
||||
border.width: 4
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0
|
||||
|
||||
SplitView {
|
||||
id: gridData
|
||||
objectName: "gridData"
|
||||
anchors.rightMargin: 4
|
||||
anchors.leftMargin: 4
|
||||
anchors.bottomMargin: 4
|
||||
anchors.topMargin: 4
|
||||
anchors.fill: parent
|
||||
|
||||
Rectangle {
|
||||
id: col1
|
||||
objectName: "col1"
|
||||
width: gridData.width / 2
|
||||
color: "#e41616"
|
||||
transformOrigin: Item.TopLeft
|
||||
border.width: 0
|
||||
|
||||
Column {
|
||||
id: data1
|
||||
objectName: "data1"
|
||||
spacing: 1
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: col2
|
||||
objectName: "col2"
|
||||
color: "#4f90e2"
|
||||
border.width: 0
|
||||
|
||||
Column {
|
||||
id: data2
|
||||
objectName: "data2"
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Column {
|
||||
Rectangle {
|
||||
id: mainView
|
||||
objectName: "mainView"
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.leftMargin: 0
|
||||
anchors.left: gridRect.right
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: parent.top
|
||||
z: 1
|
||||
clip: false
|
||||
visible: true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user