PDA

View Full Version : QWizard



Tamar
20th February 2011, 08:47
Hello,
I am a new Qt programmer,
I defined QWizard to display the wizard page i created.
I want to mention that i didn't create the wizard in Qt designer.
I want to hide the next button and i didn't suceed.
I tried all sort of options, I know there is a function called buttons() in QWizard that returns the QAbstarctButton* and the programmer can manipulate this button by using the function setHidden(),setVisible() but nothing works.
i realy appreciate quick answer.
Bests
Tamar

high_flyer
21st February 2011, 10:09
just set the buttons you want via setButton().

Tamar
21st February 2011, 11:40
I did it also.
it doesnt hide the "next" button

Bests
Tamar

high_flyer
21st February 2011, 11:46
Please show your code.

Tamar
21st February 2011, 19:57
CFillTheBox::CFillTheBox()
:QWizard()
{

setPage(FillTheBoxPage_Intro, &mIntroPage);
setPage(FillTheBoxPage_iTunes,&miTunesPage);
setPage(FillTheBoxPage_Scan, &mSearchPage);
setOption(QWizard::NoBackButtonOnStartPage,true);
setStartId(FillTheBoxPage_Intro);
setWindowTitle(tr("Fill the box"));
QAbstractButton* nextButton = button(QWizard::NextButton);
nextButton->setHidden(true);
setButton(QWizard::NextButton,nextButton);
}

I want to mention that CFillTheBox is a class that inherite from QWizard.
and what you see here is the constructor of CFillTheBox.

Bests
Tamar

high_flyer
22nd February 2011, 09:08
it doesnt hide the "next" button
Sure it doesn't since you are explicitly setting it!
See line 13 in your posted code!
You don't need to hide buttons, you just set the ones you want.

Tamar
22nd February 2011, 11:03
I did what you said and it doesnt work either

CFillTheBox::CFillTheBox()
:QWizard()
{

setPage(FillTheBoxPage_Intro, &mIntroPage);
setPage(FillTheBoxPage_iTunes,&miTunesPage);
setPage(FillTheBoxPage_Scan, &mSearchPage);
setOption(QWizard::NoBackButtonOnStartPage,true);
setStartId(FillTheBoxPage_Intro);
setWindowTitle(tr("Fill the box"));
setButton(QWizard::BackButton,new QPushButton("back"));
setButton(QWizard::CancelButton,new QPushButton("cancel"));
setButton(QWizard::FinishButton,new QPushButton("finish"));
}
It still shows the "next" button
The Qwizard has default buttons and all the default buttons are shown in the Qwizard as defult, the setButton function just create different buttons to the one that exists or create other buttons that dont exists as default in the Qwizard but doesnt hide the next button i dont want to show.
anyway I found a way to hide the next button:

QList<QWizard::WizardButton> layout;
layout << QWizard::Stretch << QWizard::BackButton << QWizard::CancelButton << QWizard::FinishButton;
setButtonLayout(layout);

high_flyer
22nd February 2011, 11:40
Set the wizard option QWizard::NoDefaultButton.
http://doc.trolltech.com/4.7/qwizard.html#WizardOption-enum

Tamar
22nd February 2011, 13:01
doesnt work again.
i used both function:
setOption(QWizard::NoDefaultButton,true); and
setOptions(QWizard::NoDefaultButton);

Tamar