Feature request #11689
Add hyperlink option to "File Name" form controls
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Forms | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 19933 |
Description
Hello,
I need to have a way to store a file URL on a dedicated field of a layer and be able to:- present it as a label rendered like an hyperlink.
- when you click on the hyperlink, it opens the file with the (OS default) good software.
I made a workaround by using a custom ui file in which I have prepared a QLabel named like the dedicated field. I have added the following properties for this QLabel in QT Creator:
- openExternalLinks: true
- textInteractionFlags: linksAccessibleByMouse
When the value of the fields is something like: <a href="file:///file/path/to/the/file.extension">file.extension</a>, it is shown as an hyperlink on the form (I think it is handled only by Qt and not an internal QGis function). When clicking on the field, Qt automagically opens the file with the proper software.
I believe that it could be done within the "File Name" form control shipped with autogenerated (or drag'n drop) forms at a reasonable cost (in development time of course).
The configuration dialog box for "File Name" form controls could be updated with a new checkbox entitled: "Show file path as hyperlink". When this checkbox is check, file path are showned as a QLabel (instead of a QLineEdit, the fileDialog button must be kept as is).
IMHO, this form of file path representation could replace a lot of the "open files" QgsActions. Furthermore, the hyperlink is directly into the form (at the right place) and there is no need to open any Qgis Action menu.
History
#1 Updated by Giovanni Manghi over 7 years ago
- Easy fix? set to No