Feature request #7236

Composer labels rendered as HTML should allow relative links

Added by Olivier Dalang over 7 years ago. Updated over 4 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:16264

Description

Hi !

I think it would be really nice if composer labels rendered as HTML allowed relative links.

The base URL could be the project's folder, so you could just have an "images" folder alongside the .qgs file and have them display with <img src="images/myimage.jpg" />
Of course, absolute url would still be possible.

It seems it shouldn't be hard to implement, since Qt allows it :
http://doc.qt.digia.com/4.7/qwebview.html#setHtml

Line 76 of qgscomposerlabel.cpp should just add the project's file location URL as a QUrl :
webPage->mainFrame()->setHtml( displayText(), *here* );

But I have no idea on how to get the project file's url from there.

Associated revisions

Revision f696b0a3
Added by Patrick Valsecchi over 4 years ago

Allow relative links in composer labels

Now labels and HTML boxes can contain relative URLs. If we don't have
a base URL, the project file will be used as a base URL (closes #7236).

Remove the exception for the labels where the images where not
loaded (unless in in PDF or image mode). It was because of a crash. Qt didn't
like having the HTML loading to be done synchronously during painting.

Fix a leak when rendering labels.

History

#1 Updated by Patrick Valsecchi over 4 years ago

I'm working on it.

#2 Updated by Patrick Valsecchi over 4 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF