From 860804a58bf47eaecdcc1acf81620bb998bf8cbf Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Sat, 9 May 2015 08:34:45 +0200 Subject: Make sure all notes are visible and with slightly improved formatting. Change-Id: I4f5b57fbc6d480039a07d9716e4039a9d5dd0b59 Reviewed-by: Gunnar Sletta --- src/Presentation.qml | 63 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/src/Presentation.qml b/src/Presentation.qml index 086e907..1616ff3 100644 --- a/src/Presentation.qml +++ b/src/Presentation.qml @@ -186,16 +186,61 @@ Item { title: "QML Presentation: Notes" visible: root.showNotes - Text { + Flickable { anchors.fill: parent - anchors.margins: parent.height * 0.1; - - font.pixelSize: 16 - wrapMode: Text.WordWrap - - property string notes: root.slides[root.currentSlide].notes; - text: notes == "" ? "Slide has no notes..." : notes; - font.italic: notes == ""; + contentWidth: parent.width + contentHeight: textContainer.height + + Item { + id: textContainer + width: parent.width + height: notesText.height + 2 * notesText.padding + + Text { + id: notesText + + property real padding: 16; + + x: padding + y: padding + width: parent.width - 2 * padding + + + font.pixelSize: 16 + wrapMode: Text.WordWrap + + property string notes: root.slides[root.currentSlide].notes; + + onNotesChanged: { + var result = ""; + + var lines = notes.split("\n"); + var beginNewLine = false + for (var i=0; i 0) + result += " "; + result += line; + } + } + + if (result.length == 0) { + font.italic = true; + text = "no notes.." + } else { + font.italic = false; + text = result; + } + } + } + } } } } -- cgit v1.2.3