summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2015-05-09 08:34:45 +0200
committerGunnar Sletta <gunnar@sletta.org>2015-05-11 08:15:53 +0000
commit860804a58bf47eaecdcc1acf81620bb998bf8cbf (patch)
tree61a71e645d3813a9af2262a8457643f74a967524
parentdda7cf39733562953d6ed7c37d43dccfc970c4ef (diff)
Make sure all notes are visible and with slightly improved formatting.
Change-Id: I4f5b57fbc6d480039a07d9716e4039a9d5dd0b59 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
-rw-r--r--src/Presentation.qml63
1 files 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<lines.length; ++i) {
+ var line = lines[i].trim();
+ if (line.length == 0) {
+ beginNewLine = true;
+ } else {
+ if (beginNewLine && result.length) {
+ result += "\n\n"
+ beginNewLine = false
+ }
+ if (result.length > 0)
+ result += " ";
+ result += line;
+ }
+ }
+
+ if (result.length == 0) {
+ font.italic = true;
+ text = "no notes.."
+ } else {
+ font.italic = false;
+ text = result;
+ }
+ }
+ }
+ }
}
}
}