diff options
Diffstat (limited to 'ui.qt/qml')
-rw-r--r-- | ui.qt/qml/Document.qml | 163 | ||||
-rw-r--r-- | ui.qt/qml/GoToKnowledge.qml | 4 | ||||
-rw-r--r-- | ui.qt/qml/MainWindow.qml | 21 | ||||
-rw-r--r-- | ui.qt/qml/Navigator.qml | 36 |
4 files changed, 224 insertions, 0 deletions
diff --git a/ui.qt/qml/Document.qml b/ui.qt/qml/Document.qml new file mode 100644 index 0000000..a3d4075 --- /dev/null +++ b/ui.qt/qml/Document.qml @@ -0,0 +1,163 @@ +import QtCore +import QtQuick +import QtQuick.Controls +import QtQuick.Dialogs +import Qt.labs.platform as Platform + +import EpistmoolUI + +Item { + Action { + id: boldAction + shortcut: StandardKey.Bold + onTriggered: docHandler.bold = !docHandler.bold + } + + Action { + id: italicAction + shortcut: StandardKey.Italic + onTriggered: docHandler.italic = !docHandler.italic + } + + Action { + id: underlineAction + shortcut: StandardKey.Underline + onTriggered: docHandler.underline = !docHandler.underline + } + + Action { + id: strikeoutAction + shortcut: "Ctrl+Shift+X" + onTriggered: docHandler.strikeout = !docHandler.strikeout + } + + Platform.ColorDialog { + id: colorDialog + currentColor: "black" + } + + Item { + id: toolbar + width: parent.width + height: childrenRect.height + + Row { + id: toolbarLeft + layoutDirection: Qt.LeftToRight + + ToolButton { + id: boldButton + text: "B" + font.bold: true + focusPolicy: Qt.TabFocus + checkable: true + checked: docHandler.bold + action: boldAction + } + ToolButton { + id: italicButton + text: "I" + font.italic: true + focusPolicy: Qt.TabFocus + checkable: true + checked: docHandler.italic + action: italicAction + } + ToolButton { + id: underlineButton + text: "U" + font.underline: true + focusPolicy: Qt.TabFocus + checkable: true + checked: docHandler.underline + action: underlineAction + } + ToolButton { + id: strikeoutButton + text: "S" + font.strikeout: true + focusPolicy: Qt.TabFocus + checkable: true + checked: docHandler.strikeout + action: strikeoutAction + } + ToolButton { + id: textColorButton + text: "\uF1FC" // icon-brush + font.family: "fontello" + focusPolicy: Qt.TabFocus + onClicked: colorDialog.open() + + Rectangle { + width: aFontMetrics.width + 3 + height: 2 + color: docHandler.activeTextColor + parent: textColorButton.contentItem + anchors.horizontalCenter: parent.horizontalCenter + anchors.baseline: parent.baseline + anchors.baselineOffset: 6 + + TextMetrics { + id: aFontMetrics + font: textColorButton.font + text: textColorButton.text + } + } + } + } + + Row { + id: toolbarRight + layoutDirection: Qt.RightToLeft + height: parent.height + anchors.left: toolbarLeft.right + anchors.right: parent.right + + Label { + text: docHandler.modifyTime.toLocaleTimeString() + + ToolTip.visible: ma.containsMouse + ToolTip.text: docHandler.modifyTime.toLocaleString() + + MouseArea { + id: ma + anchors.fill: parent + hoverEnabled: true + } + } + } + } + + DocumentHandler { + id: docHandler + document: textArea.textDocument + + // Binding for current editing state of the TextArea + cursorPos: textArea.cursorPosition + selectionBegin: textArea.selectionStart + selectionEnd: textArea.selectionEnd + + property alias family: docHandler.activeFont.family + property alias bold: docHandler.activeFont.bold + property alias italic: docHandler.activeFont.italic + property alias underline: docHandler.activeFont.underline + property alias strikeout: docHandler.activeFont.strikeout + property alias size: docHandler.activeFont.pointSize + } + + ScrollView { + id: scrollView + width: parent.width + anchors.top: toolbar.bottom + anchors.bottom: parent.bottom + + TextArea { + id: textArea + textFormat: Qt.RichText + wrapMode: TextArea.Wrap + focus: true + selectByMouse: true + persistentSelection: true + } + } +} diff --git a/ui.qt/qml/GoToKnowledge.qml b/ui.qt/qml/GoToKnowledge.qml new file mode 100644 index 0000000..f97cbcf --- /dev/null +++ b/ui.qt/qml/GoToKnowledge.qml @@ -0,0 +1,4 @@ +import QtQuick + +Item { +} diff --git a/ui.qt/qml/MainWindow.qml b/ui.qt/qml/MainWindow.qml new file mode 100644 index 0000000..d81fb4f --- /dev/null +++ b/ui.qt/qml/MainWindow.qml @@ -0,0 +1,21 @@ +import QtQuick + +Window { + width: 640 + height: 480 + visible: true + title: qsTr("Hello World") + + Navigator { + id: navigator + width: childrenRect.width + height: parent.height + } + + Document { + id: document + height: parent.height + anchors.left: navigator.right + anchors.right: parent.right + } +} diff --git a/ui.qt/qml/Navigator.qml b/ui.qt/qml/Navigator.qml new file mode 100644 index 0000000..40c66e4 --- /dev/null +++ b/ui.qt/qml/Navigator.qml @@ -0,0 +1,36 @@ +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + ColumnLayout { + spacing: 0 + + Button { + contentItem: Label { + text: qsTr("Settings") + anchors.verticalCenter: parent.verticalCenter + } + + Layout.fillWidth: true + } + + Button { + contentItem: Label { + text: qsTr("Keyword") + anchors.verticalCenter: parent.verticalCenter + } + + Layout.fillWidth: true + } + + Button { + contentItem: Label { + text: qsTr("Knowledge Fragments") + anchors.verticalCenter: parent.verticalCenter + } + + Layout.fillWidth: true + } + } +} |