3

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

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
andreb
  • 596
  • 3
  • 16
  • Set subTitleFormat(Qt::RichText) and set corresponding HTML to setSubTitle. – Ashif Aug 17 '13 at 18:30
  • Thanks for the hint, I should have mentioned a google search led me to this suggestion earlier but I forgot to include it in my original question. Other than changing the text style it doesn't seem to do much. – andreb Aug 17 '13 at 18:51

1 Answers1

0

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.

mata
  • 67,110
  • 10
  • 163
  • 162