This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main.qml | |
... | |
import { | |
... | |
} | |
var ctx qml.Context //Global var to set the qml context | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main.go | |
import { | |
... | |
} | |
type HTMLText struct { | |
qml.Object | |
Text string | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main.go | |
... | |
type HTMLText struct { | |
... | |
} | |
func (h *HTMLText) SetHTMLText(txt string) { | |
//As you can see this is a method of HTMLText that uses a pointer that we will initialize after we write this code | |
formattedTxt := blackfriday.MarkdownCommon([]byte(txt)) //blackfriday takes a byte array so we have to convert the txt string to a []byte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main.go | |
... | |
func run() error { | |
qml.RegisterTypes("TextConverter", 1, 0, []qml.TypeSpec{{ | |
// Above creates a importable type with an array of Type (qml.Objects) specifications | |
Init: func (h *HTMLText, obj qml.Object) { // Initializes the object and creates a pointer for HTMLText that we can reference from QML in the method we just created | |
h.Text = "Rich Text" //Sets default value... Could be anything | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//assets/main.qml | |
import QtQuick 2.3 | |
import QtQuick.Controls 1.4 | |
import QtQuick.Layouts 1.0 | |
import TextConverter 1.0 //The import name is the string from the first param in the qml.RegisterTypes then the number 1 is from the next param, then dot third param | |
ApplicationWindow { | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//assets/main.qml | |
... | |
TextArea { | |
id: rtarea | |
... | |
onActiveFocusChange: { //Signal if you leave or enter the focus of rtarea | |
if(!activeFocus) { //if you are not in the TextArea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//assets/main.qml | |
... | |
ApplicationWindow { | |
... | |
toolBar: ToolBar { //Create a toolbar and set it as the ApplicationWindow's toolBar | |
//This will create the space and auto adjust the other children of ApplicationWindow down | |
RowLayout { //This formats the toolbar to move the buttons side by side |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//main.go | |
... | |
type HTMLText struct { //Already created, just a point of reference | |
... | |
} | |
func (h *HTMLText) CopyToClip(txt string) { //A method of the HTMLText pointer that takes a raw markdown string | |
formatted := blackfriday.MarkdownCommon([]byte(txt)) //We've seen this before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
schema { | |
name: string @index(exact, term) . | |
can_do: uid @reverse @count . | |
title: string @index(exact, term) . | |
desc: string . | |
tag: uid @reverse @count . | |
} | |
set { | |
_:javascript <name> "javascript" . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
var(func: anyofterms(title, "first")) { | |
ticket as _uid_ | |
} | |
tickets(func: uid(ticket)) { | |
title | |
desc | |
tag { | |
~can_do { |