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. QWizard Next, Back

QWizard Next, Back

Scheduled Pinned Locked Moved General and Desktop
9 Posts 3 Posters 8.9k 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.
  • X Offline
    X Offline
    xboxnissan
    wrote on last edited by
    #1

    Hi, I've been seeking the web a lot lately, trying to find how to disable the Next and Back button.
    (Check out by yourself @Stack Overflow and many other forums):

    Why would I do that? Look at Adding a printer in Windows 7

    !http://img.techtalkz.com/DeviceAndPrinter_Win7_8.jpg(Adding printer dialog)!

    I'm doing the exact same thing for my current project, and I can't produce that GUI.

    button(QWizard::NextButton)->setEnabled(false); // doesn't work

    Reimplementing isComplete: How? I have no fields at all, just two commandlinks.

    So how disable-ing the next button?

    Thank You!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      So, why don't you just make isComplete return false then?

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xboxnissan
        wrote on last edited by
        #3

        BEcause I need the next enabled afterward. If you can do the same think as windows did (make an intro, a page like illustrated above, and two separated pages and let me know how !) thanks for the quick reply!

        1 Reply Last reply
        0
        • R Offline
          R Offline
          rokemoon
          wrote on last edited by
          #4

          In "QWizard":http://doc.qt.nokia.com/latest/qwizard.html you add "QWizardPage":http://doc.qt.nokia.com/latest/qwizardpage.html, so you can inherit QWidgetPage and in this class implement "isComplete()":http://doc.qt.nokia.com/latest/qwizardpage.html#isComplete
          Have a look to "this page":http://doc.qt.nokia.com/qq/qq22-qwizard.html#validatebeforeitstoolate also.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            OK, only you know what changes once a user has pressed one of those buttons, so only you know what should change.

            It seems to me, that you basically want to take another route through your wizard based on which buttons is pressed, right? If so, then I think that is fairly easy to achieve.

            Let your command button set a value that informs you of which one was pressed. Emit the completeChanged() signal, and let isComplete() return true if that value is non-valid. Then, you trigger the next action programatically, by adding a signal moveNext to your QWizardPage subclass, and connect that with the QWizard next() slot.

            1 Reply Last reply
            0
            • X Offline
              X Offline
              xboxnissan
              wrote on last edited by
              #6

              How to implement the completeChanged()?

              1 Reply Last reply
              0
              • A Offline
                A Offline
                andre
                wrote on last edited by
                #7

                No need to implement it, just do:
                @
                emit completeChanged();
                @

                to notify connected objects (like QWizard) that the status (may) have changed. You never implement a slot; Qt does that for you.

                1 Reply Last reply
                0
                • X Offline
                  X Offline
                  xboxnissan
                  wrote on last edited by
                  #8

                  Here are my current 2 button connect:

                  (PS: Another Specialist recommanded me to do so, and it works)
                  @QWizardPage* wizard_newdb::PageSelect()
                  {
                  ...
                  connect(linkImp, SIGNAL(clicked()), this, SLOT(gotoImport()));
                  connect(linkNew, SIGNAL(clicked()), this, SLOT(gotoCreate()));
                  ...
                  }

                  void wizard_newdb::gotoImport()
                  {
                  removePage(Page_AfterSelection1);
                  ...
                  addPage(PageRecover());
                  ...
                  next();
                  }

                  void wizard_newdb::gotoCreate()
                  {
                  removePage(Page_AfterSelection1);
                  ...
                  addPage(PageCreate());
                  ...
                  next();
                  }@

                  So, I do the following?
                  @connect(linkNew, SIGNAL(clicked()), this, SLOT(emit completeChange()));@

                  Thanks

                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    xboxnissan
                    wrote on last edited by
                    #9

                    [quote author="Andre" date="1320941333"]No need to implement it, just do:
                    @
                    emit completeChanged();
                    @

                    to notify connected objects (like QWizard) that the status (may) have changed. You never implement a slot; Qt does that for you.[/quote]

                    Finally got it, after LOT of thinking:

                    1. I did object only for the selectPage
                    2. did a public variable called bool isDecided in my Parrent QWizard.
                    3. When either buttons are pressed, parent->isDecided = true; emit completedChanged() like the following:
                      @void SelectPage::gotoCreate()
                      {
                      parentW->isNew = true;
                      emit completeChanged();
                      parentW->gotoCreate();
                      }@
                      Here is my code (partial)

                    @NewDB::NewDB(QWidget *parent)
                    : QWizard(parent)
                    {
                    setPage(Page_Intro, new IntroPage(this));
                    setPage(Page_Select, new SelectPage(this));
                    setPage(Page_After1, BlankPage());
                    }

                    void NewDB::gotoCreate()
                    {
                    removePage(Page_After1);
                    addPage(CreatePage());
                    next();
                    }

                    SelectPage::SelectPage(NewDB *parent)
                    : QWizardPage(parent)
                    {
                    parentW = parent; // Object NewDB
                    ...
                    parentW->isNew = false;
                    // Button Actions
                    connect(linkNew, SIGNAL(clicked()), this, SLOT(gotoCreate()));
                    ...
                    }

                    void SelectPage::gotoCreate()
                    {
                    parentW->isNew = true;
                    emit completeChanged();
                    parentW->gotoCreate();
                    }

                    bool SelectPage::isComplete () const {
                    if(parentW->isNew == true)
                    {
                    return true;
                    }
                    else
                    {
                    return false;
                    }
                    }@

                    Thanks a lot for the hint!

                    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