1

How to Hide the Back Button in Qt installer framework?

Please see attached image.

enter image description here

demonplus
  • 5,613
  • 12
  • 49
  • 68
Romz Lat
  • 11
  • 4

2 Answers2

1

See my answer to Qt installer framework hide or disable buttons quoted below:

For the wizard BackButton specifically, it automatically disables itself if there are no pages before the current page a la the Introduction page.

From QtScript this can be accomplished by removing any dynamic pages before the current page with installer.removeWizardPage and disabling all default pages before the current page with installer.setDefaultPageVisible(QInstaller.Introduction, false).

Community
  • 1
  • 1
Moose
  • 111
  • 3
0

There is void QWizard::setButton ( WizardButton which, QAbstractButton * button ) what means you schould be able to set a button which behaves like you need it. Derive a Class from QAbstractButton. Reimplement the paintEvent() to paint nothing and reimplement the mouseEvents to do nothing. That should do the (dirty) trick. Even if the wizard sets it to be visible, it won't draw itself and can't digest and mouse actions. Just tested it ... should work for you.

Aaron
  • 1,181
  • 7
  • 15
  • Still failing using the code below. function Controller() { setOption( QWizard::NoBackButtonOnLastPage, true ); } – Romz Lat Dec 02 '15 at 08:07
  • Using the approach above should result in an invisible back button all the time. What is the problem with the last page ? – Aaron Dec 02 '15 at 08:13
  • I want to hide the back button in the last page(for uninstall only). – Romz Lat Dec 04 '15 at 00:27
  • May be you can work around that be calling the `setButton()` function with your invisible button when the last page appears. You could use the `showEvent()` of that last widget. – Aaron Dec 04 '15 at 07:14
  • Your idea seems to be applicable to `QWizard` in C++ but I don't see how to do this on the Qt Installer Framework context, where the only thing we have is a control script (javascript). I must be missing something, isn't? – KcFnMi May 02 '21 at 08:41