This is a little tricky, but easy.
1) In your wizard's constructor, disconnect the reject() slot from the clicked() signal of the cancel button and instead connect your own slot to handle the cancel button click (my slot is called cancelEvent() here).
// install a handler for the cancel button
disconnect( button( QWizard::CancelButton ), SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( button( QWizard::CancelButton ), SIGNAL( clicked() ), this, SLOT( cancelEvent() ) );
// install a handler for the cancel button
disconnect( button( QWizard::CancelButton ), SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( button( QWizard::CancelButton ), SIGNAL( clicked() ), this, SLOT( cancelEvent() ) );
To copy to clipboard, switch view to plain text mode
2) Implement your slot handling cancellation, e.g.:
void SetupWizard::cancelEvent()
{
// allow cancel
reject();
}
}
void SetupWizard::cancelEvent()
{
if( QMessageBox::question( this, trUtf8( "Quit Setup" ), trUtf8( "Setup is not complete yet. Are you sure you want to quit setup?" ), QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) {
// allow cancel
reject();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks