Hi, I'm having some trouble trying to show a QTableView window with a push button.
When I have the following in my main.cpp, it opens both the main window and the table window:

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication a(argc,argv);
  4. //some splash screen stuff
  5. dcsTS w;
  6. w.show();
  7. //more splash screen stuff
  8.  
  9. QTableView tableView;
  10. RegModel RegModel(0);
  11. tableView.setModel(&RegModel);
  12. tableView.show();
  13.  
  14. return a.exec();
To copy to clipboard, switch view to plain text mode 

Now, I created a function that in my main window file that activates a pushbutton, that when clicked should run those same four lines of code:
Qt Code:
  1. void dcsTS::showTable(){
  2. QTableView tableView;
  3. RegModel RegModel(0);
  4. tableView.setModel(&RegModel);
  5. tableView.show();
  6. }
To copy to clipboard, switch view to plain text mode 

instead of having it in the main file. I was hoping this would magically make the table pop up when i pressed the button, however this is not the case, any ideas?