How to make links in a QWizard's subtitle clickable?

300 Views Asked by At

I am constructing a little wizard following Qt's classwizard example.

Now I set the subTitle of my QWizard instance to some html text that includes a link. I know about QLabel.setOpenExternalLinks(True) but how do I achieve the same effect with a QWizard's subTitle?

I looked at QWizardOptions but there is nothing there.

Please take a look at the following image:

http://imgur.com/zr3ILq2

I want to make www.plugincafe.com open in the default browser.

Thanks for reading.

EDIT: I am already calling self.setSubTitleFormat(1) where self is the QWizard instance and 1 is the enum value for Qt::RichText because I don't know how to get the proper enum constant in PyQt.

I tried all possible 4 enum values but other than text styling or no it didn't change anything.

The string value with the embedded HTML is 'Obtain a unique ID from <a href="http://www.plugincafe.com">www.plugincafe.com</a> or use <font color="maroon">%s</font> for testing purposes.' % PLUGIN_ID_TESTING

1

There are 1 best solutions below

0
mata On BEST ANSWER

QWizard (and QWizardPage) only expose mimimal control over the QLabel used as subtitle, but you can just iterate through all child QLabels in your QWizard and call setOpenExternalLinks(True):

for label in wizard.findChildren(QLabel):
    label.setOpenExternalLinks(True)

If you don't want to set it on all labels, then you need to check if you found the correct one.