Created
January 3, 2017 11:59
-
-
Save dtoebe/aedba350be339ce48d6fb31345699842 to your computer and use it in GitHub Desktop.
WRITE A SIMPLE MARKDOWN EDITOR WITH GO-QML - main.qml - 4
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 | |
rtarea.textFormat = TextEdit.RichText //change the rtarea.textFormat to show the RichText, default | |
} else { //if you are focused on the rtarea | |
rtarea.textFormat = TextEdit.PlainText //switch the textFormat to PlainText | |
htmlText.setHTMLText(mdarea.text) //now we grab the mdarea.text and parse the markdown | |
rtarea.text = htmlText.text //and set the newly parsed text to the rtarea.text | |
} | |
} | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment