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. Adding a custom QWizardPage in QWizard
Forum Updated to NodeBB v4.3 + New Features

Adding a custom QWizardPage in QWizard

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.5k Views 1 Watching
  • 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.
  • T Offline
    T Offline
    tesmai4
    wrote on last edited by
    #1

    I add a QWizard into my project with 4 QWizardPages in it. I added one more QWizardPage grammatically into project and want to add this new page after first 2 QWizardPages in my QWizard created by QT Designer.

    How can I do that?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      I feel no direct way to do this. WHen you add the wizard pages, ids are fixed. You need do work-around do this. You can something like follows.

      @ QList<int> pageId = wizard.pageIds();
      QList<QWizardPage*> wList;
      int size = pageId.size();
      for (int i=0;i<size;i++){
      qDebug() << pageId.at(i);
      wList.append(wizard.page(i));
      wizard.removePage(i);
      }
      wList.insert(2,wiz4);

      for (int i=0;i<size+1;i++){
           wizard.setPage(i,wList.at(i));
      }@
      

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tesmai4
        wrote on last edited by
        #3

        Thanks for your reply. I asked this question for the following scenario, as I am unable to achieve this. I considered above question as a workaround for this scenario.

        I created a wizard using QWizard and added pages into it using QWizardPages.

        I need to load image on one of the QWizardPages [call it WizardPageAlpha].

        I created a subclass of QWizardPage[call it PromotedWizardClass] and promoted my WizardPageAlpha to this class as promoted widget.

        I am unable to access the the WizardPageAlpha widgets [a QLabel] from PromotedWizardClass.

        Regards,

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Yes, as I said there is no direct API do with page re-arrangement. That's why I specified the work-around as per the original question. I felt your current posted answer is slightly different from original post. I have not completely understood your second post. Let check this.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tesmai4
            wrote on last edited by
            #5

            Thanks for prompt reply. This is what I needed to achieve:

            I created a wizard using QWizard and added pages into it using QWizardPages.

            I need to load image on one of the QWizardPages [call it WizardPageAlpha].

            I created a subclass of QWizardPage[call it PromotedWizardClass] and promoted my WizardPageAlpha to this class as promoted widget.

            I am unable to access the the WizardPageAlpha widgets [a QLabel] from PromotedWizardClass.

            After getting into this problem, I asked the above question as work around for this problem.

            My idea was that I would create a QWizardPage pragramatically and add the new QWizardPAge into its correct position in the QWizard.

            1 Reply Last reply
            0

            • Login

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