Why can't I set an enabled property on a QWizard custom button?



  • I have a QWizardPage class:

    @
    void PageOne::Refresh()
    {
    setCursor(Qt::WaitCursor);
    UnregisterScannerNotification();
    ui->lblSearching->setText(tr("Searching..."));
    repaint();
    RegisterScannerNotification();
    unsetCursor();

    wizard()->button(QWizard::CustomButton1)->setEnabled(false);    
    

    }
    @

    The QWizard class has the following in its constructor:

    @
    setButtonText(QWizard::CustomButton1, tr("Refresh"));
    setOption(QWizard::HaveCustomButton1, true);

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

    @

    The line in the QWizardPage class @wizard()->button(QWizard::CustomButton1)->setEnabled(false);@

    causes a compile error:

    pageone.cpp:82: error: C2027: use of undefined type 'QAbstractButton'

    and:

    pageone.cpp:78: error: C2227: left of '->setEnabled' must point to class/struct/union/generic type

    How else would you set the enabled property on a custom button?


  • Moderators

    AFAIK it is the correct way.
    Try including it
    @
    #include <QAbstractButton>
    @

    More info "Here":http://qt-project.org/doc/qt-4.8/dialogs-licensewizard.html



  • [quote author="p3c0" date="1405704001"]AFAIK it is the correct way.
    Try including it
    @
    #include <QAbstractButton>
    @

    More info "Here":http://qt-project.org/doc/qt-4.8/dialogs-licensewizard.html[/quote]

    It's always the little details. Thanks. Missed that one. Can't say enough for second set of eyes


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.