0

I want to set the text of a label so the user can click on it and open the directory it links to.

self.labFolder.setText("<a href={}>Folder:</a>".format(r'C:\Users\bob\Desktop'))

The above displays a blue underlined label and the cursor changes to the hand as expected, but onclick does not result in the opening of the directory.

How should I achieve this?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Spatial Digger
  • 1,883
  • 1
  • 19
  • 37
  • add `self.labFolder.setOpenExternalLinks(True)` – eyllanesc Sep 03 '21 at 00:32
  • `setOpenExternalLinks(True)` is set within qtDesigner – Spatial Digger Sep 06 '21 at 11:11
  • 1. If you do not provide information it is impossible to know what you did and what you need to do, so you must always provide a [mre], on the other hand change "\" with "/". 2) That the answer is written in C++ does not imply that it is not the solution since in the end the root is Qt whose methods have the same name in the different programming languages – eyllanesc Sep 06 '21 at 15:46

0 Answers0