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] showing the dialog in a different way
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] showing the dialog in a different way

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 3.0k 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.
  • K Offline
    K Offline
    kalster
    wrote on last edited by
    #1

    I am trying to load up the dialog in a different way so that the mainwindow does not continue to read the next line in code until the dialog is closed. is this possible? below is the code that i think will work but i am getting an error... expected primary-expression before '*' token

    the loginBox is the name to my dialog.
    @ui->stackedWidget->setCurrentWidget(loginBox);@

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Can you show us the code line where that error refers to? And also the ones just before it.

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • L Offline
        L Offline
        loladiro
        wrote on last edited by
        #3

        A modal dialog via
        @loginBox->exec();@
        is probably what you want

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kalster
          wrote on last edited by
          #4

          here are the two lines. the last line gives the error.
          @login->show();
          ui->stackedWidget->setCurrentWidget(loginBox);@

          no i don't want login->exec because i can't see the mainwindow

          1 Reply Last reply
          0
          • L Offline
            L Offline
            loladiro
            wrote on last edited by
            #5

            So, it's not really a dialog... Are you sure your error "expected primary-expression before ‘*’ token" is on that line?

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kalster
              wrote on last edited by
              #6

              yes. the loginBox is the name of the dialog. expected primary-expression before ')' token. my first post did not save the error correctly.

              1 Reply Last reply
              0
              • L Offline
                L Offline
                loladiro
                wrote on last edited by
                #7

                You'll have to show us the rest of the code (particularly where you are declaring you loginBox).

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kalster
                  wrote on last edited by
                  #8

                  i am not declaring the loginbox in the header. only at the mainwindow.cpp file.

                  @MainWindow::MainWindow(QWidget *parent) :
                  QMainWindow(parent),
                  ui(new Ui::MainWindow)
                  {
                  ui->setupUi(this);
                  login = new loginBox(this);

                  login->setModal(true);
                  

                  login->show();
                  ui->stackedWidget->setCurrentWidget(loginBox);@

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mlong
                    wrote on last edited by
                    #9

                    According to this code, you're not declaring it in the .cpp file either.

                    To declare the variable, you need to add (to your mainwindow.h file)

                    @
                    protected:
                    loginBox * login;
                    @

                    Software Engineer
                    My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

                    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