[SOLVED] showing the dialog in a different way



  • 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);@


  • Moderators

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



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



  • 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



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



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



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



  • 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);@


  • Moderators

    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;
    @


Log in to reply
 

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