seperate cell for dynamic creation (there may be a better way but im lazy)
This commit is contained in:
parent
f7f8ff2c57
commit
0362fd2227
27
cell.qml
Normal file
27
cell.qml
Normal file
@ -0,0 +1,27 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
property int index: 0
|
||||
|
||||
Text {
|
||||
id: cellText
|
||||
height: 75
|
||||
text: "hello this is text\nhaha\nhdsjfklfhaskjd"
|
||||
textFormat: Text.AutoText
|
||||
clip: true
|
||||
font.bold: false
|
||||
anchors.fill: parent
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
verticalAlignment: Text.AlignTop
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
font.pixelSize: 12
|
||||
MouseArea {
|
||||
id: cellMouse
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
|
17
main.go
17
main.go
@ -4,11 +4,16 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/kardianos/osext"
|
||||
"gopkg.in/qml.v1"
|
||||
)
|
||||
|
||||
var (
|
||||
path string
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := qml.Run(run); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error: %v\n", err)
|
||||
@ -19,13 +24,19 @@ func main() {
|
||||
func run() error {
|
||||
engine := qml.NewEngine()
|
||||
path, err := osext.ExecutableFolder()
|
||||
controls, err := engine.LoadFile(path + "/../share/main.qml")
|
||||
path = filepath.Clean(path + "/../src/github.com/lordwelch/PresentationApp/")
|
||||
fmt.Println(path)
|
||||
mainQml, err := engine.LoadFile(path + "/main.qml")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
window := controls.CreateWindow(nil)
|
||||
window.ObjectByName("data1")
|
||||
cellQml, err := engine.LoadFile(path + "/cell.qml")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
window := mainQml.CreateWindow(nil)
|
||||
|
||||
window.Show()
|
||||
window.Wait()
|
||||
|
4
main.qml
4
main.qml
@ -9,6 +9,8 @@ ApplicationWindow {
|
||||
minimumWidth: 500
|
||||
minimumHeight: 500
|
||||
property int globalForJs: 10
|
||||
width: 1000
|
||||
height: 600
|
||||
SplitView {
|
||||
id: mainSlider
|
||||
objectName: "mainSlider"
|
||||
@ -65,6 +67,7 @@ ApplicationWindow {
|
||||
anchors.left: parent.left
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: col2
|
||||
@ -94,5 +97,4 @@ ApplicationWindow {
|
||||
clip: false
|
||||
visible: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user