Skip to content
Snippets Groups Projects
Commit e2aebba8 authored by Thomas Hartmann's avatar Thomas Hartmann Committed by hjk
Browse files

WelcomePage: proper line wrapping for paths in sessions


Since qml can only wrap at spaces we have to wrap at file separators
manually.

Change-Id: Id853ab140a46e06fff3abf777ab3b234e749e17c
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 646ae570
No related branches found
No related tags found
No related merge requests found
......@@ -128,11 +128,30 @@ Item {
font: fonts.boldDescription
}
Text {
text: modelData
x: 4
function multiLinePath(path) {
if (path.length < 42)
return path;
var index = 0;
var oldIndex = 0;
while (index != -1 && index < 40) {
oldIndex = index;
index = path.indexOf("/", index + 1);
if (index == -1)
index = path.indexOf("\\", index + 1);
}
var newPath = path.substr(0, oldIndex + 1) + "\n"
+ path.substr(oldIndex + 1, path.length - oldIndex - 1);
return newPath;
}
text: multiLinePath(modelData)
font: fonts.smallPath
elide: Text.ElideMiddle
wrapMode: Text.WrapAnywhere
maximumLineCount: 2
elide: Text.ElideRight
height: font.pixelSize * 2 + 4
color: "#6b6b6b"
width: delegate.ListView.view.width - 40
width: delegate.ListView.view.width - 48
MouseArea {
anchors.fill: parent
hoverEnabled: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment