| Summary: | There are no line breaks in the placemark description | ||
|---|---|---|---|
| Product: | [Applications] marble | Reporter: | strag <strag1505> |
| Component: | general | Assignee: | marble-bugs |
| Status: | RESOLVED INTENTIONAL | ||
| Severity: | normal | CC: | nienhueser |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| URL: | https://forum.kde.org/viewtopic.php?f=217&t=131357 | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
I seem to have solved the problem. The placemark description is displayed using HTML. To preserve the original text formatting should be added the tags <pre> and </pre>: QString text = "<pre>"; //added tag <pre> text += "string 1, \n"; text += "string 2, \n"; text += "string 3 \n"; text += "</pre>"; //added tag </pre> As I understand it, it is necessary to add a "framing" of text by tags to function setDescription(QString). I never participated in opensource projects, so maybe someone can fix it before I'll understand how it's done. See https://forum.kde.org/viewtopic.php?f=217&t=131357#p354450 The description is interpreted as html, so newlines need to be indicated using <br/> or similar html tags. We could introduce some heuristic detection of plain text versus rich text and transform plain text with '\n' into rich text with '<br/>' tags, but I don't see the need for this really. Please reopen if you have a use-case. |
I add new GeoDataPlacemark to the map and do "setDescription(text)", where text contains line breaks, but placemark description displays without line breaks. Reproducible: Always Steps to Reproduce: 1. Create Qt application and add marble-widget to the form: MarbleWidget w = new MarbleWidget; 2. Add new GeoDataDocument: doc = new GeoDataDocument; w->model()->treeModel()->addDocument(doc); 3. Add new GeoDataPlacemark: GeoDataPlacemark *place = new GeoDataPlacemark; place->setCoordinate(l, b, 0, GeoDataCoordinates::Radian); // l, b - coordinates of the place 4. Create text - description of the place: QString text = "string 1, \n"; text += "string 2, \n"; text += "string 3"; 5. Set description of the place and add place to the document: place->setDescription(text); w->document()->append(place); 6. Launch application and click on the place. Actual Results: "Short Description" contains: "string 1, string 2, string 3" Expected Results: "Short Description" contains: "string 1, string 2, string 3"