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. Qt Not Allowing Opening of New Window

Qt Not Allowing Opening of New Window

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 689 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.
  • K Offline
    K Offline
    kr2i
    wrote on last edited by
    #1

    This little block of code here used to work

    Header:
    @
    private:
    Ui::MainWindow *ui;
    MainInterface *mainInterfaceOpen;
    };
    @

    CPP:
    @
    void MainWindow::on_startNewSimulationButton_clicked()
    {
    mainInterfaceOpen = new MainInterface(this);
    this->hide();
    mainInterfaceOpen->show();
    this->close();
    }
    @

    But now, after I tried the similar thing in my MainInterface class, NEITHER of them work.

    It spits back to me about my header,
    @
    error: C2143: syntax error : missing ';' before '*'
    @
    @
    private:
    Ui::MainWindow *ui;
    MainInterface *mainInterfaceOpen;
    };
    @

    So it's telling me I'm starting a new window wrong, but everywhere I look this is EXACTLY how it is supposed to be done. I have maininterface.h included... I've tried cleaning, running qmake, and rebuilding....

    What is going on?

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,
      In the on_startNewSimulationButton_clicked() your are closing your MainWindow using " this->close();" after you show the "MainInterface" window. It actually kills the MainWindow and therefore "MainInterface" also.

      157

      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