Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QWizard how to reimplement next() slot ?
Forum Update on Monday, May 27th 2025

[SOLVED] QWizard how to reimplement next() slot ?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anticross
    wrote on 20 Mar 2013, 10:19 last edited by
    #1

    I'm writing QWizard based class. I need to init next page after next button clicked. When I add just first page, next button is disabled, so thats why I add Blank next page. And need catch next button press event and initialize next Page before it appears. I need your help to do that.

    1. Enable next button when no next page.
    2. And/Or generate/reinitialize next page after next pressed

    Here is what I've got:
    @class GroupWizard : public QWizard { Q_OBJECT

    //--------------------------------------------------------------------------------------------------
    public: GroupWizard(QWidget parent = NULL);
    public: ~GroupWizard();
    //--------------------------------------------------------------------------------------------------
    private: void initWizard();
    //--------------------------------------------------------------------------------------------------
    public slots: void next();
    //--------------------------------------------------------------------------------------------------
    };@
    @//--------------------------------------------------------------------------------------------------
    GroupWizard::GroupWizard(QWidget parent /= NULL
    /) : QWizard(parent, Qt::WindowTitleHint) {

    initWizard();
    setOptions(QWizard::NoBackButtonOnStartPage|QWizard::HaveFinishButtonOnEarlyPages);
    

    }
    //--------------------------------------------------------------------------------------------------
    GroupWizard::~GroupWizard() {

    }
    //--------------------------------------------------------------------------------------------------
    void GroupWizard::initWizard() {

    const Zone & rootZone = GET_ZONE_MANAGER().getRootZone();
    
    QHashIterator<QString, Zone*> iter(rootZone.getChildren());
    QList<Zone *> zoneList;
    
    while(iter.hasNext()) {
        
        iter.next();
        zoneList.append(iter.value());
    }
    
    addPage(new GroupWizardPage(zoneList));
    /*addPage(new GroupWizardPage(zoneList));*/
    

    }
    //--------------------------------------------------------------------------------------------------
    void GroupWizard::next() {

    if (currentPage() == NULL)
        return;
    
    GroupWizardPage * curPage = (GroupWizardPage *)currentPage();
    QList<int> zoneIds = curPage->getCheckedZonesIds();        
    QHash<int, Zone *> zonesHash = GET_ZONE_MANAGER().getZones();
    QList<Zone *> zoneList;
    
    for (int i = 0; i < zoneIds.count(); i++) {
    
        Zone * zone = zonesHash.value(zoneIds.at(i));
    
        if (zone)
         zoneList.append(zone);
    }
    
    if (page(nextId()) == NULL)
        return;
    
    GroupWizardPage * nextPage = (GroupWizardPage *)page(nextId());
    
    nextPage->initPage(zoneList);
    QWizard::next();
    

    }
    //--------------------------------------------------------------------------------------------------@
    The problem is: I didn't get into my next() slot.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 20 Mar 2013, 11:23 last edited by
      #2

      Hi,

      IIRC, the next() slot from QWizard is not virtual, so you can't just reimplement it.
      Did you take a look a the example provided in "QWizard's details":http://qt-project.org/doc/qt-4.8/qwizard.html#details ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anticross
        wrote on 21 Mar 2013, 06:02 last edited by
        #3

        Method QWizard::initializePage(int id) is that what I'm looking for. So problem now solved.

        1 Reply Last reply
        0

        1/3

        20 Mar 2013, 10:19

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved