| 1 |
import QtQuick 2.4 |
| 2 |
import Lomiri.Components 1.3 |
| 3 |
import Dekko.Editor |
| 4 |
|
| 5 |
MainView { |
| 6 |
width: 500 |
| 7 |
height: 500 |
| 8 |
|
| 9 |
Page { |
| 10 |
title: "Text editor" |
| 11 |
|
| 12 |
Row { |
| 13 |
id: btnRow |
| 14 |
spacing: units.gu(0.5) |
| 15 |
anchors { |
| 16 |
top: parent.top |
| 17 |
left: parent.left |
| 18 |
right: parent.right |
| 19 |
} |
| 20 |
height: units.gu(4) |
| 21 |
|
| 22 |
EditorButton { |
| 23 |
height: parent.height |
| 24 |
active: editor.font.bold |
| 25 |
text: "B" |
| 26 |
font.weight: Font.DemiBold |
| 27 |
onClicked: editor.font.bold = !editor.font.bold |
| 28 |
} |
| 29 |
|
| 30 |
EditorButton { |
| 31 |
height: parent.height |
| 32 |
active: editor.font.italic |
| 33 |
text: "I" |
| 34 |
font.italic: true |
| 35 |
onClicked: editor.font.italic = !editor.font.italic |
| 36 |
} |
| 37 |
|
| 38 |
EditorButton { |
| 39 |
height: parent.height |
| 40 |
active: editor.font.underline |
| 41 |
text: "U" |
| 42 |
font.underline: true |
| 43 |
onClicked: editor.font.underline = !editor.font.underline |
| 44 |
} |
| 45 |
|
| 46 |
EditorButton { |
| 47 |
height: parent.height |
| 48 |
enabled: editor.canUndo |
| 49 |
iconName: "undo" |
| 50 |
onClicked: editor.undo() |
| 51 |
} |
| 52 |
|
| 53 |
EditorButton { |
| 54 |
height: parent.height |
| 55 |
enabled: editor.canRedo |
| 56 |
iconName: "redo" |
| 57 |
onClicked: editor.redo() |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
Rectangle { |
| 62 |
color: LomiriColors.silk |
| 63 |
anchors { |
| 64 |
left: parent.left |
| 65 |
right: parent.right |
| 66 |
bottom: btnRow.bottom |
| 67 |
} |
| 68 |
height: units.dp(1) |
| 69 |
} |
| 70 |
|
| 71 |
RichTextEditor { |
| 72 |
id: editor |
| 73 |
anchors { |
| 74 |
left: parent.left |
| 75 |
right: parent.right |
| 76 |
top: btnRow.bottom |
| 77 |
bottom: parent.bottom |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 81 |
} |