Skip to content

Instantly share code, notes, and snippets.

@dtoebe
Created January 3, 2017 11:52
Show Gist options
  • Save dtoebe/07a68cb5a7a736f8922653779c942700 to your computer and use it in GitHub Desktop.
Save dtoebe/07a68cb5a7a736f8922653779c942700 to your computer and use it in GitHub Desktop.
WRITE A SIMPLE MARKDOWN EDITOR WITH GO-QML - main.go - 3
//main.qml
...
import {
...
}
var ctx qml.Context //Global var to set the qml context
...
func run() error {
...
component, err := engine.LoadFile("assets/main.qml")
if err != nil {
return err
}
//Above code we have already written I just wanted to give you a point of reference
ctx = *engine.Context() //set the context with a pointer so the data stored stays persistent for the life of the variable. In this case the lifetime of the application
ctx.SetVar("mdtxt", "Markdown Editor") //Set the "mdtxt" property inside the QML file to the provided string
ctx.SetVar("rttxt", "Rich Text / HTML Editor")
...
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment