PDA

View Full Version : Weird QWizard restart problem [pyQt]



TheGrudge
27th September 2020, 14:44
Hi,

I have a wizard with 4 Pages.
The first page is an "selector" page where the user can define which operation should be taken. The page contains simple QCommandLinkButtons. When clicking on one of these buttons, the page uses

self.wizard().setStartId()
self.wizard().restart()
to set the start index and reset the wizard to the corresponding page.

But if I do so, the layout of the QWizardPage is broken and everything can be scaled down to a height of 0 (only the window title remains).
The WizardPage itself is ok, I use the widget in different places of the application.

If I call restart() again, everything is fine, so I came up with this code that works for me:

def _onButtonClicked(self, button: QAbstractButton):
if button == self.newRechtsgrundlageButton:
self.wizard().setStartId(WizardPages.Page1.value)
else:
self.wizard().setStartId(WizardPages.Page2.value)
self.wizard().restart()
# I don't know why but we have to restart twice, otherwise the window is broken
self.wizard().restart()

Is this a bug in Qt?
I want to call restart() because I don't want to be able to go back to this selector page as soon as the user choose an option.

d_stranz
27th September 2020, 17:25
Is this a bug in Qt?

Almost certainly no. You probably have bugs in the way you have designed your wizard or its pages or its navigation.