Esri / arcgis-maps-sdk-toolkit-qt

ArcGIS Maps SDK for Qt Toolkit
Apache License 2.0
132 stars 61 forks source link

BasemapGallery tooltips: enable links and adjust timing #447

Closed AndrewBladon closed 3 years ago

AndrewBladon commented 3 years ago

Html links included in tooltip's in the Basemap Gallery cannot be clicked. This PR adds a parser to remove any html tags [e.g. <html> and </html>] from tooltip text. This means the text appears as plain text and does not appear as a link.

ldanzinger commented 3 years ago

Is it possible to use something like onLinkActivated: Qt.openUrlExternally(link)

https://stackoverflow.com/questions/12536416/qml-text-element-hyperlink

anmacdonald commented 3 years ago

@ldanzinger I was not aware of this call. Maybe?

@AndrewBladon I think for Lucas's workaround the call would be:

ToolTip.toolTip.contentItem.onLinkActivated: Qt.openUrlExternally(link)
AndrewBladon commented 3 years ago

Thanks for your comments @anmacdonald and @ldanzinger.

Using a Connection we have managed to use the Qt.openUrlExternally(link) method to enable the link in the tooltip to be opened.

With this change, the timing of the tooltip needed to be modified. Currently, if the mouse leaves the thumbnail MouseArea, the tooltip will disappear. This means that a user cannot click the link in the tooltip because the tooltip disappears. Two properties are available with attached tooltips: delay and timeout, however, the timeout duration appears to be from the time the tooltip appears rather than the time the mouse leaves the MouseArea and is not suitable for this. As such, delays to the appearance and disappearance of the tooltips were manually created using two Timer objects and the onEntered and onExited slots of the MouseArea object.

Please could you review these updated changes?

NOTE: I have modified the title of the PR from Remove html links from BasemapGallery tooltips to BasemapGallery tooltips: enable links and adjust timing. This is to reflect the changes to the purpose of the work.

AndrewBladon commented 3 years ago

Thanks for your feedback @anmacdonald and for your assistance making the changes. The changes are ready for re-review.