Control of qwizard's next button

Source: Internet
Author: User
Control of qwizard's next button

Qwizard is the wizard class of QT. During the wizard process, you can use the registerfield function to register fields for global access, and you can use four methods to control the availability of the next or complete button:
The first method is the iscomplete function, which is applied to the qwizardpage to control the availability of the "Next" or "finish" button on a single Wizard Page. The function is as follows:

1 bool QWizardPage::isComplete () const[virtual]

The following is the implementation of iscomplete. The source code is from

Http://doc.qt.nokia.com/qq/qq22-qwizard.html#validatebeforeitstoolate

First, implement the qwizardpage: iscomplete () function again.

1 bool SailingPage::isComplete() const
2     {
3         return field("sailing").toDate().dayOfWeek()
4                != Qt::Sunday;
5     }

Connect the signal of the input box or other objects to be monitored to the qwizardpage: completechanged () signal.

1 connect(sailing, SIGNAL(selectionChanged()), this, SIGNAL(completeChanged()));

Of course, you can also execute the qwizardpage: completechanged () signal by yourself, that is, compile the check function and then execute the signal:

1 emit completeChanged()

Method 2: hasacceptableinput function, used for qlineedit. If hasacceptableinput is false, the button will become grayed out.

1 bool hasAcceptableInput () const

The third method is the registerfield function. The first parameter name is followed by an asterisk, for example, field *. This ensures that if this field is not filled in, the next button is grayed out.

1 void QWizardPage::registerField ( const QString & name, QWidget * widget, const char * property = 0, const char * changedSignal = 0)

The fourth method is to re-implement the bool qwizardpage: validatepage () function, which can complete the function defined by the function when you click the next or complete button. Of course, this includes verifying this type of thing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.