PDA

View Full Version : QWizard and using registerField on a QRadioButton



cprokopiak
30th December 2011, 22:01
I am trying to create a QWizard with multiple pages. In one page, I have two QRadioButton objects, which I register:


formRadioButton = new QRadioButton("Form folder");
formRadioButton->setChecked(true);
layout->addWidget(formRadioButton);
worksheetRadioButton = new QRadioButton("Worksheet folder");
layout->addWidget(worksheetRadioButton);
registerField("formRadio", formRadioButton);
registerField("worksheetRadio", worksheetRadioButton);

In a subsequent page, I am trying to determine if formRadioButton is checked, a true or false. According to the documentation (http://doc.qt.nokia.com/4.8-snapshot/qwizardpage.html#registerField), the checked property for QAbstractButton is recognized by default. So I thought something like this would work to get the value:


if( field("formRadio").checked )

The problem is that I cannot get my program to compile. I get an error message similar to: 'class QVariant' has no member named 'checked'. Looking at the QVariant documentation, it makes sense. But I'm confused how to access the checked field for a QAbstractButton object. Any clarification would be greatly appreciated.

Lesiok
31st December 2011, 08:46
Make this like :

if( field("formRadio").toBool() )