Oriol Martí
Oriol Martí

Reputation: 21

How can I customize the title of a QWizard in PyQt5?

I'm designing an assistant for charging csv files in a project with other widgets. I've almost finished the assistant, subclassing QWizard and QWizardPage, but I'm stuck in customizing the aspect of the title and the subtitle, as it have to be consistent with the aspect of the whole application

I've tried using stylesheets and setting the title with HTML code, but it isn't working as I expected. I need to have the title background being dark (#38474F) and the title color being "white" (#F0F0F0). I also want the font of the title to be Arial 12 Bold, and (if possible) the font of the subtitle to be Arial 10 (if not possible, no problem)

In the links below you can see how is the aspect of the assistant and how is the aspect of another part. I've removed the logo of the app in the second, but it is in the white square

The aspect of the assistant right now

An image of another part of the app

Upvotes: 2

Views: 543

Answers (1)

Dimitry Ernot
Dimitry Ernot

Reputation: 6584

QWizard supports rich text format for its title (see Qt doc).

If you set this property to Qt.RichText or Qt.AutoText (default value), you can use html tags in your page titles.

For example:

myPage.setTitle("<span style='color:#FF0000;'>In red</span> Normal");

Will display:

enter image description here

Upvotes: 0

Related Questions