Results 1 to 2 of 2

Thread: QWizard and using registerField on a QRadioButton

  1. #1
    Join Date
    Jul 2009
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QWizard and using registerField on a QRadioButton

    I am trying to create a QWizard with multiple pages. In one page, I have two QRadioButton objects, which I register:

    Qt Code:
    1. formRadioButton = new QRadioButton("Form folder");
    2. formRadioButton->setChecked(true);
    3. layout->addWidget(formRadioButton);
    4. worksheetRadioButton = new QRadioButton("Worksheet folder");
    5. layout->addWidget(worksheetRadioButton);
    6. registerField("formRadio", formRadioButton);
    7. registerField("worksheetRadio", worksheetRadioButton);
    To copy to clipboard, switch view to plain text mode 

    In a subsequent page, I am trying to determine if formRadioButton is checked, a true or false. According to the documentation, the checked property for QAbstractButton is recognized by default. So I thought something like this would work to get the value:

    Qt Code:
    1. if( field("formRadio").checked )
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWizard and using registerField on a QRadioButton

    Make this like :
    Qt Code:
    1. if( field("formRadio").toBool() )
    To copy to clipboard, switch view to plain text mode 

  3. The following user says thank you to Lesiok for this useful post:

    cprokopiak (3rd January 2012)

Similar Threads

  1. Replies: 1
    Last Post: 8th August 2013, 14:57
  2. Custom registerfield
    By parsnips146 in forum Newbie
    Replies: 0
    Last Post: 25th August 2010, 15:30
  3. QWizard, QComboBox and registerField() issue
    By RThaden in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2008, 12:18
  4. QRadioButton
    By sonuani in forum Newbie
    Replies: 1
    Last Post: 20th February 2008, 09:30
  5. QRadioButton
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 8th October 2007, 07:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.